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

I am getting a weird error on import #106

Open
NikolasJody opened this issue Jun 24, 2020 · 2 comments
Open

I am getting a weird error on import #106

NikolasJody opened this issue Jun 24, 2020 · 2 comments

Comments

@NikolasJody
Copy link

import loadable from 'loadable-components';
^^^^^^

SyntaxError: Cannot use import statement outside a module
at compileFunction ()
at wrapSafe (internal/modules/cjs/loader.js:1054:16)
at Module._compile (internal/modules/cjs/loader.js:1102:27)
at Module._compile (/Users/nikolasjody/development/Likuid-production/garage/aventador/node_modules/pirates/lib/index.js:83:24)
at Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Object.newLoader [as .js] (/Users/nikolasjody/development/Likuid-production/garage/aventador/node_modules/pirates/lib/index.js:88:7)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)

this is my .babelrc, i didnt set my es2015 modules to false
{
"ignore": [
"node_modules/**/*"
],
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
}

this is basically me following the steps in
#71

ive been going in circles solving one problem after another, they never stop.

here are the versions of my dev dependencies.
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/node": "^7.10.3",
"@babel/plugin-proposal-class-properties": "7.1.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-transform-modules-commonjs": "7.1.0",
"@babel/plugin-transform-react-constant-elements": "7.0.0",
"@babel/plugin-transform-react-inline-elements": "7.0.0",
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "7.0.0",
"@babel/register": "7.0.0",

i have also installed the newest node.js

@acomito
Copy link

acomito commented Nov 13, 2020

@NikolasJody any luck?

I can get it working with generic routes but not my actual routes which have other imports from third party libraries (like antd design)

@mkhoussid
Copy link

As specified in the docs,

Please note that in this case you need a module 'babel-register' to work with the ES2105 syntax and .jsx format.

So, you need to add the package babel-register and require it in your script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants