cli
cli copied to clipboard
Support for ESM in spack
My project uses ESM, but spack currently attempts to require('spack.config.js'). I can't use require with module: true, but I also cannot rename the config to spack.config.cjs or it won't be found since it's hardcoded to look for spack.config.js
Same issue here. The code examples in the docs are shown to use ESM import syntax, so that's a bit contradicting. I'm going to opt with ncc in the meantime.
I also run into this issue every time I try out swc, which is a few times now. I can't figure out how to use spack in a project with "type": "module", so I always has to dismiss it as a viable option before I can even really try it.
After about a dozen attempts to adapt the demo config file with minimal changes, I'm still stuck with:
> npx spack --config "/Users/lgarron/Code/git/github.com/cubing/cubing.js/spack.config.cjs"
thread '<unnamed>' panicked at 'cannot access a scoped thread local variable without calling `set` first', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.1/src/lib.rs:168:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^
[Error: panic detected] { code: 'GenericFailure' }
Node.js v19.7.0
For a lot of web development these days, it is quite feasible to work entirely with ESM code and no CommonJS. It would be really welcoming if that also applied to spack.