webpackvuejs3yarnpkgterserterser-webpack-plugin

Cannot find module terser-webpack-plugin when run yarn serve in Vue 3 project


I just created a Vue 3 project using Vue CLI using the default options, and when I try to run using yarn serve command I got this error

Error: Cannot find module '.../node_modules/terser-webpack-plugin/dist/index.js'. Please verify that the package.json has a valid "main" entry

What I can do to solve it?


Solution

  • I solved this issue. There was the version of terser-webpack-plugin that was installed in my project. Today some more researchs I found the issue on github (https://github.com/webpack-contrib/terser-webpack-plugin/issues/491) and update my project and then works fine.