Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'TypeError: Cannot read property 'minify' of undefined' in terser-webpack-plugin when building a new Vue CLI 3 project?

I created a new project with the Vue CLI 3 (configured: babel, pwa, eslint, mocha). Running the test environment using npm run serve works just fine, but I can't build the project for production.

I installed the current version of the Vue CLI 3 and tried creating projects with different configurations. I get the following error message when building the project.

js/app.bb3f3c6e.js from Terser
TypeError: Cannot read property 'minify' of undefined
    at minify (/Users/.../untitled/node_modules/terser-webpack-plugin/dist/minify.js:176:23)
    at module.exports (/Users/.../untitled/node_modules/terser-webpack-plugin/dist/worker.js:13:40)
    at handle (/Users/.../untitled/node_modules/worker-farm/lib/child/index.js:44:8)
    at process.<anonymous> (/Users/.../untitled-adventure/node_modules/worker-farm/lib/child/index.js:51:3)
    at process.emit (events.js:188:13)
    at emit (internal/child_process.js:828:12)
    at processTicksAndRejections (internal/process/next_tick.js:76:17)
like image 407
T-Sona Avatar asked Feb 02 '19 23:02

T-Sona


1 Answers

This is a known issue (vuejs/vue-cli#3407) with the terser 3.16 dependency.

The workaround is to install 3.14 for now:

npm i [email protected]
like image 86
tony19 Avatar answered Oct 24 '22 00:10

tony19