"Cannot use import statement outside a module" while using with nuxt-i18n
See original GitHub issueTry running yarn test in https://codesandbox.io/s/optimistic-maxwell-l1dmx?file=/tests/test.spec.js
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Cannot use import statement outside a module using nuxtjs
If you get an Cannot use import statement outside a module error, you may need to add your package to the build >...
Read more >Cannot use import statement outside a module using nuxtjs ...
[Solved]-Cannot use import statement outside a module using nuxtjs-nuxt.js ... You need to mark vue-agile to be transpiled in order to work on...
Read more >Javascript Fix Cannot Use Import Statement Outside A ...
Learn how to fix cannot use import statement outside a module error and successfully import function from another file in JavaScript.
Read more >cannot use import statement outside a module - ItsJavaScript
json will tell Node you are using ES6 modules(es modules), which should get solve the error. If you would like to use the...
Read more >How to fix SyntaxError: Cannot use import statement outside a ...
Introduction. When developing apps of scripts using Node JS you may encounter this error: SyntaxError: Cannot use import statement outside a module.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

nuxt-i18nis published as ESM module. At the moment Jest needs additional configuration to be able to transpile it.By default Jest transformers ignore
node_modulesdirectory. Jest throws an error, because it sees ESM syntax instead of expected CJS. To solve the issuenuxt-i18nshould be included in thetransformIgnorePatternssetting of Jest configuration:Here is the solution for multiple packages (adapted from Jest docs):