Error : Cannot use import statement outside a module
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 I found a work around by re-transpiling from source in my project. Hope this helps you.
I have a similar problem. Not sure what's the issue and I do not wish to transpile node_modules.