You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I put "type": "module" in my package.json, and tried to use spack but it gives the first error message.
If I specify the --config option with spack it gives the second error message.
Error messages
1st error:
spack.config.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename spack.config.js to end in .cjs,
change the requiring code to use dynamic import() which is available in all CommonJS modules,
or change "type": "module" to "type": "commonjs" in
/mnt/data/projects/elemental-loader/pkg/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
2nd error:
/mnt/data/projects/elemental-loader/pkg/node_modules/.pnpm/@swc+core@1.2.133/node_modules/@swc/core/spack.js:55
throw new Error(`Error occurred while loading config file at ${config}: ${e}`);
^
Error: Error occurred while loading config file at spack.config.cjs: Error: Cannot find module 'spack.config.cjs'
Require stack:
- /mnt/data/projects/elemental-loader/pkg/node_modules/.pnpm/@swc+core@1.2.133/node_modules/@swc/core/spack.js
The second error is because swc requires an absolute path when specifying a file with --config. As a workaround, you can do something like spack foo.ts --config "$PWD/spack.config.cjs"
Describe the bug
I put
"type": "module"
in my package.json, and tried to use spack but it gives the first error message.If I specify the
--config
option with spack it gives the second error message.Error messages
1st error:
2nd error:
Input code
Config
Playground link
No response
Expected behavior
The configuration file to be parsed and a bundled js file to be produced.
Actual behavior
Gives errors about spack config file having the .cjs extension even with the
--config
flag.Version
1.2.133
Additional context
No response
The text was updated successfully, but these errors were encountered: