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

Jest could not recognize dynamic import #59

Open
tpai opened this issue Aug 9, 2018 · 0 comments
Open

Jest could not recognize dynamic import #59

tpai opened this issue Aug 9, 2018 · 0 comments
Labels

Comments

@tpai
Copy link
Owner

tpai commented Aug 9, 2018

When you want to use dynamic import syntax, you must import babel-plugin-syntax-dynamic-import, but jest still give the unexpected token import error.

Add babel-plugin-dynamic-import-node in test environment will resolve this problem.

.babelrc

{
  "env": {
    "test": {
      "plugins": [
        "dynamic-import-node",
        "syntax-dynamic-import"
      ]
    }
  }
}

Ref: jestjs/jest#2442 (comment)

@tpai tpai added the Frontend label Aug 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant