webpack-bundler
Skill266 starsChanged 10 months agoApache-2.0View on GitHub
Best practices and guidelines for Webpack module bundler configuration, optimization, and development workflows
- Reads credentials
In this repository264 other files it gives its agents.
- accessibility-a11ySkill
- alpine-jsSkill
- analytics-data-analysisSkill
- android-developmentSkill
- angular-developmentSkill
- angularSkill
- anime-jsSkill
- anthropic-claude-developmentSkill
- api-developmentSkill
- apollo-graphqlSkill
- aspnet-coreSkill
- astroSkill
- auth0-authenticationSkill
- autogen-developmentSkill
- automl-hyperparameter-optimizationSkill
- aws-developmentSkill
- azureSkill
- backend-developmentSkill
- bash-scriptingSkill
- beautifulsoup-parsingSkill
- bitbucket-workflowSkill
- blazorSkill
- blender-python-addonSkill
- blockchainSkill
- bootstrapSkill
- business-central-developmentSkill
- cheerio-parsingSkill
- chrome-extension-developmentSkill
- ci-cd-best-practicesSkill
- clean-architectureSkill
- clean-codeSkill
- clerk-authenticationSkill
- cloudflare-developmentSkill
- computer-vision-opencvSkill
- convexSkill
- cppSkill
- c-sharpSkill
- cssSkill
- cypressSkill
- data-analysis-jupyterSkill
- data-analystSkill
- data-jupyter-pythonSkill
- deep-learning-pythonSkill
- deep-learning-pytorchSkill
- deep-learningSkill
- deno-typescriptSkill
- design-systemsSkill
- devopsSkill
- django-pythonSkill
- django-rest-api-developmentSkill
- dockerSkill
- dotnetSkill
- drizzle-ormSkill
- drupal-developmentSkill
- elasticsearch-best-practicesSkill
- electron-developmentSkill
- elixirSkill
- embedded-stm32Skill
- esbuild-bundlerSkill
- ethereumSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 11 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use Webpack 5+ features for best practices and performance
- Distinctive: line 94
Use ES6 module syntax (import/export)
- Very specific: line 180
Use webpack-bundle-analyzer to identify large dependencies
- Distinctive: line 245
Do not bundle everything into a single file
- Distinctive: line 246
Avoid importing entire libraries when only specific functions are needed
- Distinctive: line 247
Do not skip source maps in development
- Distinctive: line 248
Avoid hardcoding environment-specific values
- Distinctive: line 249
Do not ignore bundle size warnings
- Very specific: line 253
Use source maps for debugging (devtool: 'source-map')
- Distinctive: line 255
Test production builds locally before deployment
- Very specific: line 256
Use stats option to understand build output
- Distinctive: line 260
Keep Webpack and plugins up to date
- Distinctive: line 262
Use Content Security Policy headers
- Distinctive: line 263
Avoid exposing sensitive data in bundles
- Very specific: line 268
Run production builds with --mode production
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Webpack Bundler
You are an expert in Webpack, the powerful module bundler for JavaScript applications. Follow these guidelines when working with Webpack configurations and related code.
Core Principles
- Webpack is a static module bundler that builds a dependency graph from entry points
- Focus on optimal bundle size, build performance, and developer experience
- Use Webpack 5+ features for best practices and performance
- Understand the plugin and loader ecosystem
Project Structure
project/
├── src/
│ ├── index.js # Main entry point
│ ├── components/ # UI components
│ ├── utils/ # Utility functions
│ ├── styles/ # CSS/SCSS files
│ └── assets/ # Images, fonts, etc.
├── dist/ # Build output (gitignored)
├── webpack.config.js # Main configuration
├── webpack.dev.js # Development config
├── webpack.prod.js # Production config
└── package.jsonConfiguration Best Practices
Entry and Output
module.exports = {
entry: {
main: './src/index.js',
vendor: './src/vendor.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].[contenthash].js',
clean: true
}
};Mode Configuration
module.exports = {
mode: 'production', // or 'development'
// production mode enables tree-shaking, minification, and optimizations
};Code Splitting
Dynamic Imports
// Use dynamic imports for on-demand loading
const module = await import('./heavy-module.js');
// With React
const LazyComponent = React.lazy(() => import('./LazyComponent'));SplitChunks Configuration
optimization: {
splitChunks: {
chunks: 'all',
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
}
}
}
}Tree Shaking
Enable Tree Shaking
- Use ES6 module syntax (import/export)
- Set
mode: 'production' - Configure
sideEffectsin package.json
{
"sideEffects": false
}Or specify files with side effects:
{
"sideEffects": ["*.css", "*.scss"]
}Babel Configuration for Tree Shaking
{
"presets": [
["@babel/preset-env", { "modules": false }]
]
}Loaders
Common Loader Configuration
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: 'babel-loader'
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: 'ts-loader'
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource'
}
]
}Plugins
Essential Plugins
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html'
}),
new MiniCssExtractPlugin({
filename: '[name].[contenthash].css'
}),
// Use for bundle analysis
new BundleAnalyzerPlugin()
]Performance Optimization
Bundle Size Optimization
- Use
webpack-bundle-analyzerto identify large dependencies - Enable tree shaking to remove unused code
- Replace large dependencies with smaller alternatives
- Enable Gzip or Brotli compression
Build Performance
module.exports = {
cache: {
type: 'filesystem'
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
alias: {
'@': path.resolve(__dirname, 'src')
}
}
};Production Optimization
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: true
}),
new CssMinimizerPlugin()
],
moduleIds: 'deterministic',
runtimeChunk: 'single'
}Development Server
devServer: {
static: './dist',
hot: true,
port: 3000,
historyApiFallback: true,
proxy: {
'/api': 'http://localhost:8080'
}
}Environment Variables
const webpack = require('webpack');
plugins: [
new webpack.DefinePlugin({
'process.env.API_URL': JSON.stringify(process.env.API_URL)
})
]Common Anti-Patterns to Avoid
- Do not bundle everything into a single file
- Avoid importing entire libraries when only specific functions are needed
- Do not skip source maps in development
- Avoid hardcoding environment-specific values
- Do not ignore bundle size warnings
Testing and Debugging
- Use source maps for debugging (
devtool: 'source-map') - Analyze bundles regularly with
webpack-bundle-analyzer - Test production builds locally before deployment
- Use
statsoption to understand build output
Security Considerations
- Keep Webpack and plugins up to date
- Validate and sanitize all user inputs
- Use Content Security Policy headers
- Avoid exposing sensitive data in bundles
Integration with CI/CD
- Cache node_modules and Webpack cache
- Run production builds with
--mode production - Fail builds on bundle size budget violations
- Generate and store bundle analysis reports
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

