Webpack - SyntaxError: Unexpected token {

narupo

I have introduced Webpack for Django and Vue. But I get an error. I can't execute webpack. What this error?

$ node --use_strict ./node_modules/.bin/webpack --config webpack.config.js
node_modules/webpack-command/lib/cli.js:5
const { register } = require('./global');
        ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3
yotke

You're trying to destructure a require call. Node version must support destructuring. Another option is to compile with babel-node.

If node supports it (node v6 and newer), check if you export register in ./global.js.

I made a demo for you here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related