-
-
Notifications
You must be signed in to change notification settings - Fork 750
Description
System Info
System:
OS: macOS 15.3.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 39.12 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.18.3 - ~/.nvm/versions/node/v20.18.3/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v20.18.3/bin/yarn
npm: 10.8.2 - ~/.nvm/versions/node/v20.18.3/bin/npm
Browsers:
Chrome: 133.0.6943.127
Edge: 133.0.3065.82
Safari: 18.3
npmPackages:
@rspack/cli: 1.2.4 => 1.2.4
@rspack/core: 1.2.4 => 1.2.4
@rspack/plugin-react-refresh: ^1.0.1 => 1.0.1
Details
I started to get the following error this week when running npx rspack preview --port 2900
/Users/HIDDEN_PATH/rspack.config.ts:1
import { defineConfig } from "@rspack/cli";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (node:internal/modules/cjs/loader:1378:20)
at Module._compile (node:internal/modules/cjs/loader:1428:41)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Module._load (node:internal/modules/cjs/loader:1104:12)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at crossImport (/Users/HIDDEN_PATH/node_modules/@rspack/cli/dist/index.js:515:22)
at loadRspackConfig (/Users/HIDDEN_PATH/node_modules/@rspack/cli/dist/index.js:563:20)
at RspackCLI.loadConfig (/Users/HIDDEN_PATH/node_modules/@rspack/cli/dist/index.js:694:38)
in the project I'm working we have this versions in the package.json:
"@rspack/cli": "^1.2.3",
"@rspack/core": "^1.2.3",
"@rspack/plugin-react-refresh": "^1.0.1",
I have tried with a fresh project using yarn create rspack that have installed the following versions in the package.json:
"@rspack/cli": "^1.2.6",
"@rspack/core": "^1.2.6",
"@rspack/plugin-react-refresh": "^1.0.1",
And got same error
I have tried pinning versions to the following in the package.json:
"@rspack/cli": "1.2.3",
"@rspack/core": "1.2.3",
and it successfully work
I have tried pinning versions to the following in the package.json:
"@rspack/cli": "1.2.4",
"@rspack/core": "1.2.4",
and it failed, so that makes me think a bug was introduced in v1.24 🤔
Reproduce link
No response
Reproduce Steps
Steps:
- create new rspack project :
yarn create rspack - install modules:
yarn install - build that project:
yarn run build - try to preview build:
npx rspack preview --port 2900 - 😵
