This lecture uses Webpack version 4, but recently it has been majorly updated to version 5. Plugins related to Webpack are also released as updated versions for compatibility, and among them, terser-webpack-plugin used in the lecture has been updated from 4 to 5. Some of you may have encountered error messages because of this, so please refer to the method shared by "쭁" below.
Error message
- "TypeError: Cannot read property 'javascript' of undefined"
- Hi you are using Webpack 4 and Terser
^5.0.0
. This version of Terser is for Webpack 5, you need to set version"terser-webpack-plugin": "^4.2.3",
inpackage.json
file
How to solve
- In package.json, change the terser-webpack-plugin version from 5 to ^4.2.3 Change to