hard-source-webpack-plugin icon indicating copy to clipboard operation
hard-source-webpack-plugin copied to clipboard

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Open kuebelkasten opened this issue 7 years ago • 3 comments

Expected Behavior

It should run as described

Actual Behavior

It does not run

Is an error being thrown?

\node_modules\hard-source-webpack-plugin\index.js:49 let ops = 0; ^^^ SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Steps to Reproduce

  • I've installed package through npm
  • Added const HardSourceWebpackPlugin = require('hard-source-webpack-plugin'); to webpack.config.js
  • run webpack and got the error

Operating System, Node, and NPM dependency versions

Windows 10 Pro
Node version
{ 
  npm: '6.1.0',
  ares: '1.14.0',
  cldr: '33.0',
  http_parser: '2.8.0',
  icu: '61.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.32.0',
  node: '10.5.0',
  openssl: '1.1.0h',
  tz: '2018c',
  unicode: '10.0',
  uv: '1.20.3',
  v8: '6.7.288.46-node.8',
  zlib: '1.2.11' 
}

  "dependencies": {
    "bootstrap": "3.3.7",
    "classnames": "^2.2.5",
    "moment": "^2.19.2",
    "pathval": "^1.1.0",
    "paypal-checkout": "4.0.187",
    "react": "16.2.0",
    "react-bootstrap": "0.31.5",
    "react-dom": "16.2.0",
    "react-geosuggest": "2.7.0",
    "react-transition-group": "2.2.0",
    "webpack": "^3.6.0"
  },
  "devDependencies": {
    "@types/classnames": "^2.2.3",
    "@types/node": "9.6.7",
    "@types/react": "16.0.40",
    "@types/react-bootstrap": "0.31.6",
    "@types/react-dom": "16.0.4",
    "@types/react-geosuggest": "2.3.0",
    "awesome-typescript-loader": "3.2.3",
    "babel-core": "6.26.3",
    "babel-preset-env": "1.7.0",
    "prop-types": "^15.6.0",
    "source-map-loader": "0.2.1",
    "typescript": "2.7.2",
    "webpack-bundle-analyzer": "^2.9.2",
    "hard-source-webpack-plugin": "0.9.0"
  }

kuebelkasten avatar Jun 29 '18 17:06 kuebelkasten

This is a pretty bizarre error. I'm not sure how to recreate this error. hard-source is actively tested on Node 10.

Node 4 added some support for block scoped declaractions and 6 added full support to my recall.

mzgoddard avatar Jul 01 '18 19:07 mzgoddard

I've got the same problem. Any luck resolving @kuebelkasten ?

naazy avatar Jul 26 '18 10:07 naazy

I run into same issue. In my case I was pulling the latest version of newman and running it with fixed version of node (4). With the latest release of newman (v4) compatibility with node is as follow: Newman | Node v3.x | >= v4.x v4.x | >= v6.x

valasatava avatar Aug 08 '18 00:08 valasatava