Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ESM in spack #177

Open
cmmartin opened this issue Nov 10, 2022 · 2 comments
Open

Support for ESM in spack #177

cmmartin opened this issue Nov 10, 2022 · 2 comments

Comments

@cmmartin
Copy link

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

@muradbu
Copy link

muradbu commented Nov 11, 2022

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.

@lgarron
Copy link

lgarron commented Mar 18, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants