madskristensen / WebPackTaskRunner

A Visual Studio extension
Other
39 stars 16 forks source link

Syntax Error while Executing Webpack in Task Runner #49

Closed shawnwildermuth closed 6 years ago

shawnwildermuth commented 6 years ago

Installed product versions

Description

Fails to run webpack with syntax error

Steps to recreate

  1. Create a webpack.config.js file.
  2. Right-click to open Task Runner
  3. See Task Runner show correctly.
  4. Right-click on any of the options and call execute.
  5. See error.
  6. Copy the actual commandline.
  7. Open a console and execute the commandline.
  8. See it work outside the Task Runner Window.

Current behavior

Runs and shows syntax error:

D:\courses\vue-webpage\Examples\Exemplar2> cmd /c SET NODE_ENV=production&& webpack --color
D:\courses\vue-webpage\Examples\Exemplar2\node_modules\webpack\bin\webpack.js:24
let webpackCliInstalled = false;
^^^
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 Function.Module.runMain (module.js:429:10)
    at startup (node.js:139:18)
    at node.js:999:3
Process terminated with code 1.

Here is a screenshot:

image

Expected behavior

Just works.

shawnwildermuth commented 6 years ago

Looks like it's because I was still using VS's embedded node version (which was ancient). Fixed by moving the tools path to the bottom:

image

Karan-Adhikari commented 5 years ago

Not sure if an obsolete version of Node was also part of the problem, but what Shawn Wildermuth suggested worked (after updating Node) - moved the option $(VSINSTALLDIR)\Web\External to the bottom. Thanks Shawn!

K4m0 commented 4 years ago

Looks like it's because I was still using VS's embedded node version (which was ancient). Fixed by moving the tools path to the bottom:

image

Moved the option $(VSINSTALLDIR)\Web\External to the bottom works for me without update Node. Thanks Shawn!