microsoft / TypeScript-Babel-Starter

A sample setup using Babel CLI to build TypeScript code, and using TypeScript for type-checking.
MIT License
2k stars 229 forks source link

Webpack build does not run due to terser-webpack-plugin dependency #34

Closed JacobTheEvans closed 5 years ago

JacobTheEvans commented 5 years ago

Thanks

First off great starting guide! Decided I wanted to learn Typescript and your starter guide has helped a lot. Just so you are aware when using the additional webpack configure the project will not build. Im not sure if you would like a PR with the fix to this issue as it seems the maintainers are already working on solving this on there end but if so I would be happy to help.

Problem

terser-webpack-plugin crashes when Webpack is ran.

Logs

Starting type checking service...
Using 1 worker with 2048MB memory limit
Hash: 8deabb4a8938f47197c2
Version: webpack 4.28.3
Time: 498ms
Built at: 2019-02-02 21:17:59
 1 asset
Entrypoint main = bundle.js
[0] ./src/index.ts 1.66 KiB {0} [built]

ERROR in bundle.js from Terser
TypeError: Cannot read property 'minify' of undefined
    at minify (/home/jacob/Development/personal/content-tweeter/node_modules/terser-webpack-plugin/dist/minify.js:175:23)
    at module.exports (/home/jacob/Development/personal/content-tweeter/node_modules/terser-webpack-plugin/dist/worker.js:13:40)
    at handle (/home/jacob/Development/personal/content-tweeter/node_modules/worker-farm/lib/child/index.js:44:8)
    at process.<anonymous> (/home/jacob/Development/personal/content-tweeter/node_modules/worker-farm/lib/child/index.js:51:3)
    at emitTwo (events.js:126:13)
    at process.emit (events.js:214:7)
    at emit (internal/child_process.js:772:12)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! content-tweeter@1.0.0 build:js: `webpack --mode=production`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the content-tweeter@1.0.0 build:js script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

More Info

This has already been reported to the maintainers https://github.com/webpack-contrib/terser-webpack-plugin/issues/67

And is explained in https://github.com/webpack-contrib/terser-webpack-plugin/issues/66

Fix

As stated in Issue 66 add the following to your package.json

  "resolutions": {
    "terser": "3.14.1"
  }
JacobTheEvans commented 5 years ago

Issue has been fixed in the latest version