terser-webpack-plugin
UglifyJS2
terser-webpack-plugin | UglifyJS2 | |
---|---|---|
6 | 15 | |
1,941 | 13,091 | |
0.2% | - | |
6.1 | 8.6 | |
13 days ago | 5 days ago | |
JavaScript | JavaScript | |
MIT License | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
terser-webpack-plugin
-
Webpack npm run build with React Typescript
const path = require('path'); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); const HtmlWebpackPlugin = require('html-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const TerserPlugin = require("terser-webpack-plugin"); module.exports = { // watch: true, mode: "production", entry: "./src/index.tsx", output: { filename: 'main.js', path: path.resolve(__dirname, 'build') }, optimization: { chunkIds: 'named', minimizer: [ new TerserPlugin({ parallel: true, terserOptions: { // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions }, }), new CssMinimizerPlugin(), ], }, plugins: [ new MiniCssExtractPlugin(), new HtmlWebpackPlugin({ template: path.resolve(__dirname, './public/index.html'), // template file filename: 'index.html', // output file }), new CleanWebpackPlugin(), ], module: { rules: [ { test: /\.(js|jsx)$/, exclude: /(node_modules|bower_components)/, use: { loader: 'babel-loader', options: { presets: ['@babel/preset-env', "@babel/preset-react"] } } }, { test: /\.css$/i, use: [ MiniCssExtractPlugin.loader, { loader: 'css-loader', options: { importLoaders: 1 } }, { loader: 'postcss-loader', options: { postcssOptions: { plugins: [ [ 'autoprefixer', { overrideBrowserslist: ['last 3 versions', 'ie >9'] }, ], ], }, }, }, ], }, { test: /\.scss$/i, use: [ MiniCssExtractPlugin.loader, { loader: 'css-loader', options: { importLoaders: 1 } }, { loader: "postcss-loader", options: { postcssOptions: { plugins: [ [ "autoprefixer", { overrideBrowserslist: ['last 3 versions', 'ie >9'] }, ], ], }, }, }, 'sass-loader' ], }, { test: /\.(svg|eot|woff|woff2|ttf)$/, use: ['file-loader'] }, { test: /\.tsx?$/, loader: "ts-loader", exclude: /node_modules/, options: { allowTsInNodeModules: true } } ] }, resolve: { extensions: ["*",".ts", ".tsx", ".js", "jsx"] }, }
-
Popular React Webpack Plugins for 2022
There are lots of options available with this plugin which you can check here.
- Is it fair to be skeptical of minification software, since they can potentially inject stuff?
-
Minimizing Webpack bundle size
Make sure Webpack is in production mode on release! Webpack applies a number of optimizations to your bundle, including minification with TerserWebpackPlugin if you’re using Webpack v4 or above. If not, you’ll have to install and add it manually. Other optimizations include omitting development-only code and using optimized assets.
-
is there any way to config webpack to generate single quoted code instead of double quoted code?
Specifically quote_mode in terser-webpack-plugin
-
My first public React 17 Boilerplate (with Webpack 5, Tailwind 2)
terser-webpack-plugin - Optimize and minimize JavaScript
UglifyJS2
-
Proven Strategies to Optimize JavaScript Load Times in Modern Web Development
UglifyJS
-
How to improve page load speed and response times: A comprehensive guide
Minification involves removing unnecessary characters, whitespace, and comments from code files. It helps reduce HTML, CSS, JavaScript, etc., file sizes without compromising functionality. Removing redundant elements makes these HTML, JavaScript, and CSS files smaller. Since smaller code files need less internet traffic to transfer, they load faster. Utilizing tools like UglifyJS, Clean-CSS, and HTMLMinifier enhances this process of code reduction. They analyze the code, remove redundant code, and generate optimized files for deployment.
-
10 Bad Habits That Can Slow Down Your JavaScript Applications 🐌
Example: You've got a main.js file that's as long as a Tolstoy novel. Fix: Use tools like UglifyJS or Terser to minify your code. They'll squeeze out all the unnecessary bits and give you a sleeker, faster-loading file.
-
How To Secure Your JavaScript Applications
Minification: UglifyJS, Terser
-
Minifying for production
There are a bunch of libraries that do this, but my current go to is Uglify: https://www.npmjs.com/package/uglify-js
-
Overview of the next-gen frontend dev tools
There are many minifiers such as terser and uglify. But, because minifying also require to parse the JS, it is actually possible to use esbuild and SWC to minify the code. Here's a benchmark of the main minifiers.
-
JavaScript and CSS minification.
In my understanding, UglifyJS 3 is the most popular JavaScript minifier tool presently -- it has a very high weekly download too. And as per the official documentation, it supports ES6.
-
Enhanced noise suppression in Jitsi Meet
I'm thinking reverse-engineered uglified js code (https://github.com/mishoo/UglifyJS) is not as impenetrable as code from reversed engineered wasm binaries? The element of plausible deniability is much more potent though, for the nefarious actor on the other side.
-
PhpStorm File Watchers
Program: uglifyjs Arguments: $FileName$ -c -m -o $FileNameWithoutExtension$.min.js
-
Minify JavaScript Using Terser
Apart from terser, you can also use uglify-js to compress or minify javascript.
What are some alternatives?
html-webpack-plugin - Simplifies creation of HTML files to serve your webpack bundles
terser - 🗜 JavaScript parser, mangler and compressor toolkit for ES6+
react-webpack-5-tailwind-2 - React 17 Boilerplate with Webpack 6, Tailwind 2, using babel, SASS/PostCSS, HMR, dotenv and an optimized production build
HTMLMinifier - Javascript-based HTML compressor/minifier (with Node.js support)
mini-css-extract-plugin - Lightweight CSS extraction plugin
imagemin - [Unmaintained] Minify images seamlessly
clean-webpack-plugin - A webpack plugin to remove your build folder(s) before building
clean-css - Fast and efficient CSS optimizer for node.js and the Web
babel-plugin-lodash - Modular Lodash builds without the hassle.
babili - :scissors: An ES6+ aware minifier based on the Babel toolchain (beta)
webpack-bundle-analyzer - Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap
minimize - Minimize HTML