Va1 / browser-sync-webpack-plugin

Easily use BrowserSync in your Webpack project.
MIT License
369 stars 40 forks source link

New version 2.0.1 breaks #58

Closed salamalala closed 6 years ago

salamalala commented 6 years ago

the new version 2.0.0 throws an error when running webpack --watch

(function (exports, require, module, __filename, __dirname) { const { extend, isFunction } = require('lodash')
                                                                    ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/ninaregli/vagrant-local/www/cofi/public_html/wp-content/themes/cofi/node_modules/browser-sync-webpack-plugin/index.js:1:89)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)`

Version 1.1.4 seems to work fine. These are my dependencies in my package.json file:

"devDependencies": {
    "browser-sync": "^2.23.6",
    "browser-sync-webpack-plugin": "^1.1.4",
    "css-loader": "^0.28.9",
    "extract-text-webpack-plugin": "^3.0.2",
    "lodash": "^4.17.5",
    "node-sass": "^4.7.2",
    "postcss-loader": "^2.1.0",
    "sass-loader": "^6.0.6",
    "style-loader": "^0.20.1",
    "uglifyjs-webpack-plugin": "^1.1.8",
    "webpack": "^3.10.0"
  },
malinbranduse commented 6 years ago

@salamalala Hello! Could you provide your node version and webpack config? I'm quite sure it's your node version is the culprit. Yes, version 2.0.1 does have breaking changes (it's a major release following semantic versioning), the biggest one being use of ES6 which is only supported in node v4.

Va1 commented 6 years ago

@salamalala as pointed out by @malinushj , the fact that error is SyntaxError and it is being thrown for destructuring code ensures me that it's caused by not using Node v4 or higher. please, make sure that you're on up-to-date Node or downgrade the package to v1

Va1 commented 6 years ago

i assume this one is resolved. thanks