terser-webpack-plugin
webpack-bundle-analyzer
terser-webpack-plugin | webpack-bundle-analyzer | |
---|---|---|
6 | 20 | |
1,924 | 12,501 | |
0.1% | 0.1% | |
6.6 | 6.2 | |
2 months ago | 25 days ago | |
JavaScript | JavaScript | |
MIT License | MIT License |
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
webpack-bundle-analyzer
-
Bundle size analyzer when using esbuild?
I used to use webpack-bundle-analyzer but we have switched the builder to browser-esbuild now.
-
How to handle multiple webpacks in the same app, that both include React?
First start by running a webpack bundle analysis to see what exactly is bundled. You might be surprised about things being included that you didn't expect which can help with where to look.
-
Building a PNPM monorepo with Webpack - large builds?
Firstly I recommend taking a look at the structure of the webpack output with something like webpack-bundle-analyzer for any obvious over bundling issues.
-
First time i encounter this any idea how to exploit it ? or its already an info disclosure and i should report within bug bounty program ?
See: https://github.com/webpack-contrib/webpack-bundle-analyzer
-
Web Performance Resources for Front End Developers
Webpack Bundle Analyzer
- Beautiful Visualizations For Your App's Dependencies
-
🚀 Angular 14 + ESLint, Material + Transloco + Jest, TestCafe + Docker + Prettier 🚀
npm run analyse - analyse bundle with webpack-bundle-analyzer
-
I shaved 80 MB from my TypeScript build by removing googleapis
This was my question as well. The article does answer the question, but off the bat I'd assumed the author was talking about output/dist. The web treemap cli is a great tip. If you are using webpack, webpack-bundle-analyzer is a helpful tool for quickly finding bloated packages. It's definitely helped me cut down my build times: https://github.com/webpack-contrib/webpack-bundle-analyzer
-
Zero experience with Angular. I'm in charge of our CI and we're getting extremely slow prod build times (~1 hour 34 mins). Where should I start researching solutions for this?
Here are a few tipps where you could save some time: 1)check angular.json (configurations -> "your ci config") - look for buildOptimizer / optimization 2)If you run npm ci during your pipeline it might make sense to create the node modules folder beforehand, it seems to save time (https://github.com/npm/cli/issues/2011) 3)Use ng build --stats-json to analyze your build 4)Use https://github.com/webpack-contrib/webpack-bundle-analyzer (also works together with 3. ) 5)Check your package.json for unused dependencies 6)Check your imports, import only what is needed Hope this helps
-
The best Angular 13 Starter Project
- `npm run start` - Start the app - `npm run lint` - Lint the project - `npm run test` - Run unit tests - `npm run build` - Build the project - `npm run build:prod` - Build the project in production mode - `npm run build:prod:stats` - Build the project in product mode with stats - `npm run analyse` - Analyse bundle with [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) - `npm run compodoc` - Generate [compodoc](https://github.com/compodoc/compodoc) documentation - `npm run version` - Generate changelog - `npm run prettier` - Format the whole project - `npm run audit` - Audit this application using Sonatype OSS Index
What are some alternatives?
html-webpack-plugin - Simplifies creation of HTML files to serve your webpack bundles
awesome-vite - ⚡️ A curated list of awesome things related to Vite.js
react-webpack-5-tailwind-2 - React 17 Boilerplate with Webpack 6, Tailwind 2, using babel, SASS/PostCSS, HMR, dotenv and an optimized production build
vite-plugin-svgr - Vite plugin to transform SVGs into React components
clean-webpack-plugin - A webpack plugin to remove your build folder(s) before building
esbuild - An extremely fast bundler for the web
mini-css-extract-plugin - Lightweight CSS extraction plugin
rollup-plugin-visualizer - 📈⚖️ Visuallize your bundle
UglifyJS2 - JavaScript parser / mangler / compressor / beautifier toolkit
lighthouse - Automated auditing, performance metrics, and best practices for the web.
babel-plugin-lodash - Modular Lodash builds without the hassle.
babel-plugin-import - Modularly import plugin for babel.