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

ReferenceError: Cannot access 'store' before initialization #173

Closed
a-lba opened this issue Jul 1, 2024 · 1 comment
Closed

ReferenceError: Cannot access 'store' before initialization #173

a-lba opened this issue Jul 1, 2024 · 1 comment

Comments

@a-lba
Copy link

a-lba commented Jul 1, 2024

When moving from babel-jest to @swc/jest I am getting "ReferenceError: Cannot access 'store' before initialization" error.

swc configuration:
transform: { '^.+\\.jsx?$': [ require.resolve('@swc/jest'), { jsc: { target: 'es2017', parser: { syntax: 'ecmascript', jsx: true, decorators: true, dynamicImport: false, }, transform: { legacyDecorator: true, react: { runtime: 'automatic' } }, }, module: { type: 'commonjs' }, sourceMaps: 'inline' } ] },

@kdy1
Copy link
Member

kdy1 commented Jul 1, 2024

swc-project/swc#7435

Evaluation order of module: "commonjs" is different from tsc.
The behavior of tsc is wrong. ESM is an established standard, and the specification explicitly says that ESM imports are hoisted.

@kdy1 kdy1 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 1, 2024
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

2 participants