Webpack Config Generator
Writing a webpack.config.js from memory means recalling the exact shape of output, the test regex for each loader and how the plugins wire up. This generator turns that into a short form: set your entry file, output folder and build mode, then tick the pieces you need, TypeScript, Babel, a CSS loader, HtmlWebpackPlugin and a dev server. It writes a clean, ready-to-copy webpack 5 config with [contenthash] filenames and output.clean already in place.
How to build a webpack config
-
1
Set entry and output
Type your entry file (default `./src/index.js`) and the output folder (default `dist`).
-
2
Choose the mode
Pick `production` or `development`. It is written straight into the `mode` field.
-
3
Toggle loaders and plugins
Turn on TypeScript (`ts-loader`), Babel (`babel-loader`), a CSS loader (`style-loader` + `css-loader`), `HtmlWebpackPlugin` and a dev server as needed.
-
4
Copy the config
The `webpack.config.js` updates live. Use the copy button and paste it into your project root.
Default output
With the defaults (production mode, TypeScript, Babel, a CSS loader and HtmlWebpackPlugin), the generator writes:
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'production',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.[contenthash].js',
clean: true,
},
resolve: { extensions: ['.ts','.tsx','.js'] },
module: {
rules: [
{ test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/ },
{ test: /\.jsx?$/, exclude: /node_modules/, use: 'babel-loader' },
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
],
},
plugins: [
new HtmlWebpackPlugin({ template: './src/index.html' }),
],
};
What each option writes
| Option | What it adds to the config |
|---|---|
| entry | The entry value, e.g. entry: './src/index.js'. |
| output folder | output.path, resolved with path.resolve(__dirname, 'dist'). |
| mode | mode: 'production' or mode: 'development'. |
| TypeScript | A ts-loader rule for .ts/.tsx, plus those extensions in resolve. |
| Babel | A babel-loader rule for .js/.jsx. |
| CSS loader | A rule chaining style-loader and css-loader for .css. |
| HtmlWebpackPlugin | The require line plus new HtmlWebpackPlugin({ template: './src/index.html' }). |
| dev server | A devServer block serving the output folder on port 3000 with hot reload. |
Fixed choices in the output
To keep the starter config clean, a few values are set for you rather than exposed as fields:
- Hashed filenames.
output.filenameis alwaysbundle.[contenthash].js, which busts the browser cache whenever the bundle changes. - Clean output.
output.clean: trueempties the output folder on each build, the webpack 5 replacement forclean-webpack-plugin. - CSS is bundled, not extracted.
style-loaderinjects styles through JavaScript. To emit a separate.cssfile for production, addMiniCssExtractPluginyourself. - Dev server basics. When enabled,
devServersetsstatic,port: 3000andhot: true. Add options such ashistoryApiFallbackorproxyby hand if your app needs them.
Extending it further
The generated file is a starting point, not a full production setup. Common next steps you add by hand: MiniCssExtractPlugin for extracted CSS, sass-loader for .scss, webpack 5 asset modules for images and fonts, a devtool value for source maps, and a splitChunks block for code splitting.
Frequently Asked Questions
Webpack 5. The output uses output.clean and [contenthash] filenames, the modern webpack 5 conventions, so no extra clean plugin is needed.
No, it always writes a JavaScript webpack.config.js. Enabling the TypeScript toggle adds a ts-loader rule so webpack can compile your .ts/.tsx source; it does not change the format of the config file itself.
The generated devServer block uses port 3000 with hot reload. Change the port value in the copied file if you need a different one.
Yes. Each toggle adds its own rule (ts-loader for .tsx?, babel-loader for .jsx?), so you can enable one, the other or both depending on how your project transpiles.
Related Tools
ASCII Table Reference
Full ASCII table from 0 to 127 with decimal, hex, octal, binary, standard names and HTML numeric-reference notation, including NUL, LF and DEL.
Color Palette Generator
Generate monochromatic, analogous, complementary, triadic or tetradic color palettes from a base HEX color and export copy-ready CSS variables.
HTML Character Reference
Searchable list of HTML entities, their named and numeric codes, and a one-click copy for special characters and symbols.
FPS Counter
Measure browser FPS with requestAnimationFrame, smoothing, min/max frame rate, warnings and an optional graph. Runs locally with no upload or API.
Color Wheel Explorer
Explore the colour wheel interactively. Rotate harmonies, compare HSL vs RYB, spot complementary and triadic pairs in real time.
JavaScript Deobfuscator
Deobfuscate minified or packed JavaScript with variable renaming, string-array decoding, control-flow flattening reversal and beautification.
Tool available in other languages
- Generator konfiguracji webpack [PL]
- ตัวสร้างการตั้งค่า Webpack [TH]
- Generador de Configuración de Webpack [ES]
- Webpack設定ジェネレーター [JA]
- مولّد إعدادات Webpack [AR]
- Webpack 설정 생성기 [KO]
- Trình tạo cấu hình webpack [VI]
- Générateur de configuration Webpack [FR]
- Webpack-Konfigurationsgenerator [DE]
- Generator Konfigurasi Webpack [ID]
- Gerador de Configuração Webpack [PT]
- Webpack-konfigurationsgenerator [SV]
- Webpack-configuratiegenerator [NL]
- Generatore di Configurazione Webpack [IT]
- Генератор конфигурации webpack [RU]
- Webpack Yapılandırma Oluşturucu [TR]
- Webpack 配置生成器 [ZH]