cloudle / react-universal-ui-boilerplate

React cross-platform boilerplate (React Natives and Web).
20 stars 3 forks source link

Unexpected token on webpack.config.js:95 #1

Open ghost opened 6 years ago

ghost commented 6 years ago

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.
cloudle commented 6 years ago

@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)

ghost commented 6 years ago

Thank you, I’ll try this

On Mon, Feb 12, 2018 at 12:47 PM cloudle notifications@github.com 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 .