perf: add webpack production optimizations
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
- Extract CSS to separate files for better caching - Split vendor chunks for optimized loading - Remove console.log statements in production builds - Disable source maps in production - Configure terser for better compression These optimizations should reduce bundle size and improve page load performance.
This commit is contained in:
@@ -189,6 +189,32 @@ export default {
|
||||
/*
|
||||
** You can extend webpack config here
|
||||
*/
|
||||
extend(config, ctx) {},
|
||||
extractCSS: true, // Extract CSS into separate files
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
chunks: 'all',
|
||||
automaticNameDelimiter: '.',
|
||||
name: undefined,
|
||||
cacheGroups: {
|
||||
vendor: {
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
priority: -10
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
terser: {
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true // Remove console.log in production
|
||||
}
|
||||
}
|
||||
},
|
||||
extend(config, ctx) {
|
||||
// Disable source maps in production
|
||||
if (!ctx.isDev) {
|
||||
config.devtool = false
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user