Closed oguilleux closed 3 years ago
encountered the same problem, i am building my typescript babel react project.
i use v4.2.3 of terser-webpack-plugin, it builds successfully
@Jerry-zhk why need to spam?
Because terser-webpack-plugin@5
doesn't have compatibility with webpack@4, please read readme, don't understand why it is so hard
I'm not using webpack 4 but webpack 5.
Please take a look at my initial post.
You asked how do we reproduce?
I answered : Update version of webpack & terser to latest then make build of assets of project : https://github.com/oguilleux/webpack-gulp-wordpress-starter-theme
So if you update package.json to webpack 5.1.2 and terser-webpack-plugin to 5.0.0 and make the build you will reproduce the bug.
webpack-stream
uses webpack@4
, so you got this problem https://github.com/shama/webpack-stream/blob/master/package.json#L37, sorry nothing to fix here, webpack should be in peer deps inside webpack-stream
, not in dependencies
Okay thanks for highlighting this !
Solved by updating my gulp pipe and passing webpack in webpack-steam as you can see here.
Now I have this showing up :
[DEP_WEBPACK_WATCH_WITHOUT_CALLBACK] DeprecationWarning: A 'callback' argument need to be provided to the 'webpack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.
It seems similar to this issue though my build doesn't fail. I'll wait for your PR.
@oguilleux yep, we are working on it, release with fix will be today/tomorrow
Any news? Still having this issue with 5.0.3
@Tofandel seriously? Please read the CHANGELOG
This happenend to me with Webpack5.15.0 and Terser5.5.1
Problem was that I only did yarn add -D wepack
and forgot to do yarn add -D webpack-cli
not necessarily related to webpack4.
This is by far one of the funniest GitHub issues i've seen.
Don't know why a lot of :-1: webpack-stream
had webpack v4 in dependencies, so when you run npm i
you will have webpack
v4 and v5 in node_modules
, because we previously used import webpack from 'webpack';
and you can have webpack v4 in node_modules/webpack
due npm logic, we got webpack v4 but API was written for webpack v5. We rewritten our code do not use import webpack from 'webpack';
in favor compiler.webpack
, so nobody faced with these problems in future.
I donβt know where itβs so much negative in people, even more using emoji in these case is not help somebody, if you faced with a problem please provide information, so I can help you, thanks
If you are using webpack v5 or above you do not need to install this plugin. Webpack v5 comes with the latest terser-webpack-plugin out of the box. Using Webpack v4, you have to install terser-webpack-plugin v4.
@tomatobybike You do if you want to override its settings.
@alexander-akait you are getting a lot of thumbs down because you are not being pleasant in your responses. Instead of getting exasperated the first time someone asks a question and saying, "Seriously?! RTFM!!!" try exercising a little more patience and empathy. I understand you are dealing with a lot more than just this one GitHub issue, but one comment here isn't spam. I'm trying to be nothing but honest and helpful here as I've sent my fair share of online messages that I regret. β
@as-zlynn-philipps I don't say any angry word, just ask a question and answer there was problem, even more I describe the problem and there it should be fixed https://github.com/webpack-contrib/terser-webpack-plugin/issues/335#issuecomment-710004332, that problem https://github.com/webpack-contrib/terser-webpack-plugin/issues/335#issuecomment-709716106 is not helpful, it was clear from the first message, sometimes I can't just take and immediately answer what the problem is, but I did it the next day
Expected Behavior
Build doesn't fail
Actual Behavior
Build fails with : TypeError: Cannot read property 'javascript' of undefined at /node_modules/terser-webpack-plugin/dist/index.js:366:38
Code
My config :
How Do We Reproduce?
Update version of webpack & terser to latest then make build of assets of project : https://github.com/oguilleux/webpack-gulp-wordpress-starter-theme