react-universal-ui-boilerplate icon indicating copy to clipboard operation
react-universal-ui-boilerplate copied to clipboard

Unexpected token on webpack.config.js:95

Open ghost opened this issue 8 years ago • 2 comments

Hello, I just installed the app and after running yarn web I am getting this error

SyntaxError: Unexpected token ...
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:528:28)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/artetam/Desktop/react-universal-ui-boilerplate/webpack.devserver.js:3:16)
    at Module._compile (module.js:556:32)
error Command failed with exit code 1.

ghost avatar Feb 12 '18 16:02 ghost

@michelarteta: I guess it caused by your Node.js version, if possible upgrade it to latest LTS version (now is 8.9.4).. which support Object Spreading syntax.

Incase that is not convenient to upgrade, change this (webpack.config.js line 95):

new HtmlWebpackPlugin({
	...htmlOptions,
	template: 'index.ejs',
	filename: 'index.html',
}),

to

new HtmlWebpackPlugin(Object.assign(htmlOptions, {
	template: 'index.ejs',
	filename: 'index.html',
}),

(similar bug may happen with the plugins: [..] area cause it use modern array concat as well -> use Array.concat in that case)

cloudle avatar Feb 12 '18 17:02 cloudle

Thank you, I’ll try this

On Mon, Feb 12, 2018 at 12:47 PM cloudle [email protected] wrote:

@michelarteta https://github.com/michelarteta: I guess it caused by your Node.js version, if possible upgrade it to latest LTS version (now is 8.9.4).. which support Object Spreading https://babeljs.io/docs/plugins/transform-object-rest-spread/ syntax.

Incase that is not convenient to upgrade, change this (webpack.config.js line 95):

new HtmlWebpackPlugin({ ...htmlOptions, template: 'index.ejs', filename: 'index.html', }),

to

new HtmlWebpackPlugin(Object.assign(htmlOptions, { template: 'index.ejs', filename: 'index.html', }),

(similar bug may happen with the plugins: [..] area cause it use modern array concat as well -> use Array.concat in that case)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cloudle/react-universal-ui-boilerplate/issues/1#issuecomment-365003442, or mute the thread https://github.com/notifications/unsubscribe-auth/AEJ3oo2Kx4Ho9vOBratFxdMNkeMT2sHXks5tUHkcgaJpZM4SCekY .

ghost avatar Feb 12 '18 17:02 ghost