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

1

6

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)
Forwarder answered 2/2, 2019 at 23:38 Comment(0)
E
7

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]
Emmaemmalee answered 2/2, 2019 at 23:50 Comment(1)
I was configuring webpack and had the same error. and install npm i [email protected] fixed it. thxSanches

© 2022 - 2024 — McMap. All rights reserved.