SyntaxError: Cannot use import statement outside a module at wrapSafe (internal/modules/cjs/loader.js:1117:16)
See original GitHub issueHi hi
I’m getting this error at build in a clean project bootstrapped with Expo + NextJS… 💦
import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1117:16)
at Module._compile (internal/modules/cjs/loader.js:1165:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
at Module.load (internal/modules/cjs/loader.js:1050:32)
at Function.Module._load (internal/modules/cjs/loader.js:938:14)
at Module.require (internal/modules/cjs/loader.js:1090:19)
at require (internal/modules/cjs/helpers.js:75:18)
at Object.<anonymous> (/mnt/c/Users/Eon/dev/dripsy/e10-app/node_modules/dripsy/lib/commonjs/css/index.js:1:958)
at Module._compile (internal/modules/cjs/loader.js:1201:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
at Module.load (internal/modules/cjs/loader.js:1050:32)
at Function.Module._load (internal/modules/cjs/loader.js:938:14)
at Module.require (internal/modules/cjs/loader.js:1090:19)
at require (internal/modules/cjs/helpers.js:75:18)
at Object.<anonymous> (/mnt/c/Users/Eon/dev/dripsy/e10-app/node_modules/dripsy/lib/commonjs/css/create-native-themed-component.js:1:492)
at Module._compile (internal/modules/cjs/loader.js:1201:30)
Any thoughts? 🤔
Here’s my package:
{
"name": "dripsy-test",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "next",
"eject-next": "next-expo customize",
"eject": "expo eject"
},
"dependencies": {
"dripsy": "^0.5.2",
"expo": "~37.0.3",
"next": "^9.5.2",
"next-compose-plugins": "^2.2.0",
"next-transpile-modules": "^4.1.0",
"react": "~16.11.0",
"react-dom": "~16.11.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
"react-native-web": "~0.12.0"
},
"devDependencies": {
"@expo/next-adapter": "^2.1.25"
},
"resolutions": {
"@theme-ui/core": "0.4.0-rc.1",
"@theme-ui/css": "0.4.0-rc.1",
"@theme-ui/mdx": "0.4.0-rc.1"
}
}
The resolutions are there as a temporary workaround to issue #26 as theme-ui is broken as of this writing. 🦑
Nando: Amazing project! Thank you 🍷 🍷
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
SyntaxError: Cannot use import statement outside a module
But I don't see how the suggestion to use import() to access es6 module in CommonJS is useful. It's async and so can't...
Read more >JS Fix For "SyntaxError: Cannot Use Import Statement Outside ...
"SyntaxError: Cannot use import statement outside a module" is a common Node.js error when working with import to include modules or ...
Read more >SyntaxError: Cannot use import statement outside a module ...
SyntaxError : Cannot use import statement outside a module #1625 ... a module at wrapSafe (internal/modules/cjs/loader.js:891:16) at Module.
Read more >Cannot use import statement outside a module [React ...
When building a web application, you may encounter the SyntaxError: Cannot use import statement outside a module error.
Read more >Node.js cannot use import statement outside a module
i am using the below code but i am getting this error (node:9612) Warning: To load an ES module, set "type": "module" in...
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 FreeTop 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
Top GitHub Comments
Sounds good. I’m more of a fan of Nextjs, so I’ve spent my time there with Dripsy. Good luck!
It’s working! I messed up the config. Confirmed that the theme-ui workaround works. Thanks!