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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

import.meta.url is still not working when using ESM #11634

Closed
initplatform opened this issue Jul 2, 2021 · 4 comments
Closed

import.meta.url is still not working when using ESM #11634

initplatform opened this issue Jul 2, 2021 · 4 comments

Comments

@initplatform
Copy link

馃悰 Bug Report

When using all the correct incantations from #9430 (comment) I am still seeing:

error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.

To Reproduce

Steps to reproduce the behavior:

git clone https://github.com/initplatform/jest-import-meta-example
npm install
npm start
npm test

NOTE: Need to keep ts-node at 9.1.1 for now, otherwise can not use jest.config.ts

Reference -> #11453

Expected behavior

Expect the test to not throw an error

Link to repl or repo (highly encouraged)

https://github.com/initplatform/jest-import-meta-example

envinfo

System:
OS: macOS 11.4
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Binaries:
Node: 14.17.1 - ~/bin/node
Yarn: 1.22.10 - ~/npm-global/bin/yarn
npm: 6.14.13 - ~/bin/npm
npmPackages:
jest: 27.0.6 => 27.0.6

@gayuru
Copy link

gayuru commented Nov 12, 2021

+1 as it does not detect the module option from tsconfig or tsconfig.spec.json

@gayuru
Copy link

gayuru commented Nov 12, 2021

@initplatform did you have the fix for this?

@SimenB
Copy link
Member

SimenB commented Nov 12, 2021

error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.

That's a typescript error, it doesn't come from jest. Probably an issue for ts-jest - Jest itself does zero type checks

@SimenB SimenB closed this as completed Nov 12, 2021
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants