Workbox: Add minimum node information to project

Created on 3 Jun 2017  路  7Comments  路  Source: GoogleChrome/workbox

Library Affected:
workbox-sw, workbox-webpack-plugin, etc.

Issue Description:
when running the webpack.config I am getting the following error:

 ... node_modules\workbox-webpack-plugin\build\index.js:32
class WorkboxBuildWebpackPlugin {
^^^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:404:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> 
    at Module._compile (module.js:397:26)
    at Object.Module._extensions..js (module.js:404:10)
Process terminated with code 1.

When I manually add 'use strict' to

node_modules\workbox-webpack-plugin\build\index.js

it gets resolved and throws an error from another file.
webpack.config.js https://github.com/dhananshan/PWA.NetCore/blob/master/PWA.NetCore/webpack.config.js

Node: 8.0.0
npm: 5.0.0

All 7 comments

OK, It's because visual studio has its own node which uses an older version. I synced with global node now its working, but yet the issue exist with node < 6v.

@addyosmani @jeffposnick should we be adding in a minimum version of node to our package.json? Would that have helped with this?

We have

"engines": {
  "node": ">=4.0.0"
}

in the package.json for workbox-webpack-plugin.

We have

"engines": {
  "node": ">=6.0.0"
},

in our top-level package.json for the monorepo. In general, we've been assuming node 6+ throughout the code, and have been liberal with using ES2015 features.

At the same time, create-react-app still supports node 4, and the longer-term goal is to start using workbox-webpack-plugin there. So perhaps we should add Babel transpilation with the node 4 preset into the workbox-webpack-plugin build process?

i guess it shouldn't be a big change adding it into the babel process

Should we make it a blanket node-4 support for CLI, build and webpack-plugin?

Everything has node 4.0.0 in the node modules so I think we are ok to close this issue now

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fillah picture Fillah  路  3Comments

nevaan9 picture nevaan9  路  4Comments

xe21500 picture xe21500  路  4Comments

rafzan picture rafzan  路  3Comments

josephliccini picture josephliccini  路  4Comments