Webpack configuration utilities providing user config and CLI option management for Ice framework build systems
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Comprehensive set of 33 configuration options for customizing webpack builds, covering output settings, module resolution, development tools, CSS/JavaScript processing, and platform-specific features.
Configuration options that control how and where build outputs are generated.
interface BuildOutputConfig {
/**
* Output directory for build files
* @default "build"
*/
outputDir?: string;
/**
* Public path for assets in production
* @default "/"
*/
publicPath?: string;
/**
* Public path for assets in development
* @default "/"
*/
devPublicPath?: string;
/**
* Output filename pattern for JavaScript files
* @default "[name].js"
*/
filename?: string;
/**
* Enable hash in filenames for cache-busting
* @default false
*/
hash?: string | boolean;
/**
* Asset path configuration for different file types
* @default { js: "js", css: "css" }
*/
outputAssetsPath?: {
js?: string;
css?: string;
};
}Usage Example:
// In build configuration file (e.g., build.json or ice.config.js)
module.exports = {
outputDir: 'dist',
publicPath: '/static/',
filename: '[name].[contenthash].js',
hash: true,
outputAssetsPath: {
js: 'scripts',
css: 'styles'
}
};Options for configuring how modules are resolved and imported.
interface ModuleResolutionConfig {
/**
* Path aliases for module resolution
* @default {}
*/
alias?: Record<string, string>;
/**
* File extensions to resolve automatically
* @default ['.js', '.jsx', '.json', '.html', '.ts', '.tsx', '.rml']
*/
extensions?: string[];
/**
* Directories to search for modules
* @default ['node_modules']
*/
modules?: string[];
/**
* External dependencies that shouldn't be bundled
* @default {}
*/
externals?: Record<string, any>;
}Usage Example:
module.exports = {
alias: {
'@': './src',
'@components': './src/components',
'@utils': './src/utils'
},
extensions: ['.ts', '.tsx', '.js', '.jsx', '.vue'],
modules: ['node_modules', 'src'],
externals: {
'react': 'React',
'react-dom': 'ReactDOM'
}
};Configuration for development server and debugging tools.
interface DevelopmentConfig {
/**
* Development server configuration
* @default Complex object with hot reload, CORS, etc.
*/
devServer?: {
disableHostCheck?: boolean;
compress?: boolean;
transportMode?: string;
logLevel?: string;
clientLogLevel?: string;
hot?: boolean;
publicPath?: string;
quiet?: boolean;
watchOptions?: {
ignored?: RegExp;
aggregateTimeout?: number;
};
before?: (app: any) => void;
};
/**
* Enable mock server for API mocking
* @default true
*/
mock?: boolean;
/**
* Proxy configuration for development server
* @default {}
*/
proxy?: Record<string, any>;
}Usage Example:
module.exports = {
devServer: {
hot: true,
compress: true,
port: 3000,
host: 'localhost'
},
mock: true,
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}
};Options for controlling build optimization and minification.
interface OptimizationConfig {
/**
* Enable minification for production builds
*/
minify?: boolean;
/**
* Enable source map generation
*/
sourceMap?: boolean;
/**
* Browser support targets for Babel and CSS processing
* @default "last 2 versions, Firefox ESR, > 1%, ie >= 9, iOS >= 8, Android >= 4"
*/
browserslist?: string | object;
/**
* Enable vendor chunk splitting
* @default true
*/
vendor?: boolean;
/**
* Terser minification options
* @default {}
*/
terserOptions?: Record<string, any>;
}Configuration for CSS, Less, and Sass processing.
interface CSSProcessingConfig {
/**
* CSS loader configuration options
* @default {}
*/
cssLoaderOptions?: Record<string, any>;
/**
* Less loader configuration options
* @default {}
*/
lessLoaderOptions?: Record<string, any>;
/**
* Sass loader configuration options
* @default {}
*/
sassLoaderOptions?: Record<string, any>;
/**
* Use postcss config file (.postcssrc)
* @default false
*/
postcssrc?: boolean;
/**
* PostCSS options object
*/
postcssOptions?: Record<string, any>;
}Usage Example:
module.exports = {
cssLoaderOptions: {
modules: true,
localIdentName: '[name]__[local]___[hash:base64:5]'
},
lessLoaderOptions: {
lessOptions: {
modifyVars: {
'@primary-color': '#1890ff'
}
}
},
sassLoaderOptions: {
additionalData: '@import "~@/styles/variables.scss";'
},
postcssrc: true
};Configuration for Babel compilation and JavaScript processing.
interface JavaScriptProcessingConfig {
/**
* Additional Babel plugins to apply
* @default []
*/
babelPlugins?: any[];
/**
* Additional Babel presets to apply
* @default []
*/
babelPresets?: any[];
/**
* Dependencies that should be compiled by Babel
* @default []
*/
compileDependencies?: string[];
/**
* Enable modular import runtime optimization
*/
modularImportRuntime?: boolean;
/**
* Polyfill configuration
* @default "entry"
*/
polyfill?: string | boolean | object;
}Usage Example:
module.exports = {
babelPlugins: [
['import', { libraryName: 'antd', style: true }, 'antd']
],
babelPresets: [
['@babel/preset-env', { useBuiltIns: 'usage', corejs: 3 }]
],
compileDependencies: ['@my-org/shared-components'],
polyfill: 'usage'
};Configuration for development tools and code quality.
interface DevelopmentToolsConfig {
/**
* ESLint configuration
* Can be boolean to enable/disable or object for custom config
*/
eslint?: boolean | Record<string, any>;
/**
* Enable TypeScript type checking
* @default false
*/
tsChecker?: boolean;
/**
* Global variable definitions for DefinePlugin
* @default {}
*/
define?: Record<string, any>;
}Usage Example:
module.exports = {
eslint: {
extends: ['@my-org/eslint-config'],
rules: {
'no-console': 'warn'
}
},
tsChecker: true,
define: {
API_BASE_URL: JSON.stringify(process.env.API_BASE_URL),
FEATURE_FLAGS: {
newDashboard: true,
betaFeature: false
}
}
};Configuration for building libraries and packages.
interface LibraryBuildConfig {
/**
* Library target type for UMD builds
* @default ""
*/
libraryTarget?: string;
/**
* Library name for UMD builds
* @default ""
*/
library?: string | object;
/**
* Library export mode
* @default ""
*/
libraryExport?: string | string[];
}Usage Example:
module.exports = {
libraryTarget: 'umd',
library: 'MyLibrary',
libraryExport: 'default'
};Advanced configuration options for specialized build scenarios.
interface AdvancedBuildConfig {
/**
* Enable DLL (Dynamic Link Library) bundling
* @default false
*/
dll?: boolean;
/**
* DLL entry configuration
* @default {}
*/
dllEntry?: Record<string, string[]>;
/**
* Build targets for multi-platform builds
*/
targets?: string[];
/**
* Custom webpack loaders configuration
*/
webpackLoaders?: Record<string, any>;
/**
* Custom webpack plugins configuration
*/
webpackPlugins?: Record<string, any>;
/**
* Mode-specific configuration overrides
* @default {}
*/
modeConfig?: Record<string, any>;
/**
* Disable runtime framework initialization
* @default false
*/
disableRuntime?: boolean;
}Usage Example:
module.exports = {
dll: true,
dllEntry: {
vendor: ['react', 'react-dom', 'lodash']
},
targets: ['web', 'weex'],
webpackPlugins: {
'my-custom-plugin': {
enable: true,
options: {
customOption: 'value'
}
}
},
modeConfig: {
development: {
publicPath: '/dev/',
sourceMap: true
},
production: {
publicPath: '/prod/',
sourceMap: false
}
},
disableRuntime: false
};