Answer the question
In order to leave comments, you need to log in
How to properly use webpack?
Installed yii2, now you need to run it through webpack, the configuration file is already there, but it gives the following error:
E:\gag\api\webpack.config.babel.js:4
import path from 'path';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at new Script (vm.js:88:7)
at NativeCompileCache._moduleCompile (E:\gag\api\node_modules\v8-compile-cache\v8-compile-cache.js:242:18)
at Module._compile (E:\gag\api\node_modules\v8-compile-cache\v8-compile-cache.js:186:36)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1159:10)
at Module.load (internal/modules/cjs/loader.js:988:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Module.require (internal/modules/cjs/loader.js:1028:19)
at require (E:\gag\api\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at WEBPACK_OPTIONS (E:\gag\api\node_modules\webpack-cli\bin\convert-argv.js:133:13)
at requireConfig (E:\gag\api\node_modules\webpack-cli\bin\convert-argv.js:135:6)
at E:\gag\api\node_modules\webpack-cli\bin\convert-argv.js:142:17
at Array.forEach (<anonymous>)
at module.exports (E:\gag\api\node_modules\webpack-cli\bin\convert-argv.js:140:15)
at E:\gag\api\node_modules\webpack-cli\bin\cli.js:241:39
at Object.parse (E:\gag\api\node_modules\yargs\yargs.js:567:18)
at E:\gag\api\node_modules\webpack-cli\bin\cli.js:219:8
at Object.<anonymous> (E:\gag\api\node_modules\webpack-cli\bin\cli.js:538:3)
at Module._compile (internal/modules/cjs/loader.js:1139:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1159:10)
at Module.load (internal/modules/cjs/loader.js:988:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Module.require (internal/modules/cjs/loader.js:1028:19)
at require (internal/modules/cjs/helpers.js:72:18)
at module.exports (C:\Users\mrsta\AppData\Roaming\npm\node_modules\webpack-cli\node_modules\import-local\index.js:16:66)
at C:\Users\mrsta\AppData\Roaming\npm\node_modules\webpack-cli\bin\cli.js:15:6
at Object.<anonymous> (C:\Users\mrsta\AppData\Roaming\npm\node_modules\webpack-cli\bin\cli.js:366:3)
at Module._compile (internal/modules/cjs/loader.js:1139:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1159:10)
at Module.load (internal/modules/cjs/loader.js:988:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question