Skip to content

The export statement generated by v5.99.5 combined with ts-loader has syntax errors #19423

@ShenHongFei

Description

@ShenHongFei

Bug report

What is the current behavior?
There is a syntax error in the export statement in the file generated after packaging

// EXTERNAL MODULE: ./node_modules/.pnpm/@koa+cors@5.0.0/node_modules/@koa/cors/index.js
var cors = __webpack_require__(5374);
var cors_default = /*#__PURE__*/__webpack_require__.n(cors);
;// ./entry.ts

export { koa as Koa, (cors_default()) as KoaCors };

(cors_default()) as KoaCors has SyntaxError

If the current behavior is a bug, please provide the steps to reproduce.
https://github.com/ShenHongFei/webpack-bug

What is the expected behavior?

There are no syntax errors in the generated files after packaging

// EXTERNAL MODULE: ./node_modules/.pnpm/@koa+cors@5.0.0/node_modules/@koa/cors/index.js
var cors = __webpack_require__(5374);
;// ./entry.js

export { koa as Koa, cors as KoaCors };

Other relevant information:
webpack version: v5.99.5 (latest)
Node.js version: v24.0.0 (latest main branch)
Operating System: windows 11 latest
Additional tools: ts-loader (latest ^9.5.2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions