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

Error : Cannot use import statement outside a module #16

Open
Arshazar opened this issue Jun 5, 2020 · 2 comments
Open

Error : Cannot use import statement outside a module #16

Arshazar opened this issue Jun 5, 2020 · 2 comments

Comments

@Arshazar
Copy link

Arshazar commented Jun 5, 2020

I use Afterjs and when I load a page with reactstrap-formik used in it, I encounter the error.
Its stack :

node_modules/reactstrap-formik/dist/index.js:1\nimport ReactstrapInput from './ReactstrapFormikInput';\n^^^^^^\n\nSyntaxError: Cannot use import statement outside a module\n at compileFunction ()\n at wrapSafe (internal/modules/cjs/loader.js:1072:16)\n at Module._compile (internal/modules/cjs/loader.js:1122:27)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)\n at Module.load (internal/modules/cjs/loader.js:1002:32)\n at Function.Module._load (internal/modules/cjs/loader.js:901:14)\n at Module.require (internal/modules/cjs/loader.js:1044:19)\n at require (internal/modules/cjs/helpers.js:77:18)\n at Object.reactstrap-formik (.../external "reactstrap-formik":1:1)\n at webpack_require (.../build/webpack:/webpack/bootstrap:754:1)"

But when I switch to the page by router from another page not using the module, everything's fine...

@gruffT
Copy link

gruffT commented Nov 25, 2020

@Arshazar I found a work around by re-transpiling from source in my project. Hope this helps you.

@wtLau
Copy link

wtLau commented Jun 18, 2021

I have a similar problem. Not sure what's the issue and I do not wish to transpile node_modules.

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