reactstrap-formik icon indicating copy to clipboard operation
reactstrap-formik copied to clipboard

Error : Cannot use import statement outside a module

Open Arshazar opened this issue 5 years ago • 2 comments

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...

Arshazar avatar Jun 05 '20 07:06 Arshazar

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

gruffT avatar Nov 25 '20 11:11 gruffT

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

wtLau avatar Jun 18 '21 22:06 wtLau