TypeError: webpack.optimize.UglifyJsPlugin is not a constructor
See original GitHub issueThis is in webpack@4.0.0-beta.0
Do you want to request a feature or report a bug?
bug
What is the current behavior?
TypeError: webpack.optimize.UglifyJsPlugin is not a constructor
If the current behavior is a bug, please provide the steps to reproduce.
const webpack = require('webpack');
new webpack.optimize.UglifyJsPlugin()
Also:
$ npm i webpack@4.0.0-beta.0
$ node -e 'console.log(require("webpack").optimize)'
{ AggressiveMergingPlugin: [Getter],
AggressiveSplittingPlugin: [Getter],
ChunkModuleIdRangePlugin: [Getter],
LimitChunkCountPlugin: [Getter],
MinChunkSizePlugin: [Getter],
ModuleConcatenationPlugin: [Getter],
OccurrenceOrderPlugin: [Getter],
RuntimeChunkPlugin: [Getter],
SideEffectsFlagPlugin: [Getter],
SplitChunksPlugin: [Getter] }
What is the expected behavior?
webpack.optimize.UglifyJsPlugin === function
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
❯ node v8.6.0 ❯ npm 5.6.0 ❯ webpack 4.0.0-beta.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:29 (12 by maintainers)
Top Results From Across the Web
TypeError: webpack.optimize.UglifyJsPlugin is not a constructor
As you may notice that the plugin uglifyjs-webpack-plugin is being deprecated and in the terser-webpack-plugin comes in as replacement.
Read more >UglifyjsWebpackPlugin | webpack
This plugin uses uglify-js to minify your JavaScript. Requirements. This module requires a minimum of Node v6.9.0 and Webpack v4.0.0. Getting Started.
Read more >webpack.optimize JavaScript and Node.js code examples
Returns a formatted string of the compilation information (similar to CLI output). DefinePlugin · UglifyJsPlugin · Stats.hasErrors,; Compiler.plugin,; Compiler.
Read more >DevExtreme Bundler does not work with Webpack 4
UglifyJsPlugin plugin was removed in Webpack 4 is confirmed in the TypeError: webpack.optimize.UglifyJsPlugin is not a constructor GitHub ...
Read more >uglifyjs-webpack-plugin - npm
UglifyJS plugin for webpack. Latest version: 2.2.0, last published: 3 years ago. Start using uglifyjs-webpack-plugin in your project by ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any docs available for
config.optimization.minimize
? Google brings up zero results.Also it’d be nice to include a friendly message about this in webpack itself because plenty of people will be hitting that error.
I was using an outdated structure, the config needs to be wrapped with
uglifyOptions
:Sorry for spamming.