Skip to content

[Bug]: JavaScript parsing error: 'import', and 'export' cannot be used outside of module code #7887

@yinhunfeixue

Description

@yinhunfeixue

System Info

system: macos 15.0
node: 20.16.0

Details

rspack.zip

操作步骤:

  1. 解压附件文件
  2. npm i
  3. node pack.js

JavaScript parsing error: 'import', and 'export' cannot be used outside of module code

问题:
mode: "development" 正常
mode: "production", 报错
image

Reproduce link

No response

Reproduce Steps

see details

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpending triageThe issue/PR is currently untouched.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions