Skip to content

Instantly share code, notes, and snippets.

@frague59
Created October 21, 2021 13:01
Show Gist options
  • Save frague59/ee2a604a90459052ba45d56b672889fd to your computer and use it in GitHub Desktop.
Save frague59/ee2a604a90459052ba45d56b672889fd to your computer and use it in GitHub Desktop.
Dev settings
/* Dev settings for webpack build */
const merge = require('webpack-merge')
const common = require('./webpack.common')
const path = require('path')
const DEBUG_ANALYZE = true
const config = merge(common, {
mode: 'development',
devtool: 'eval',
output: {
path: path.resolve(__dirname, './bundles'),
filename: './[name]-[contenthash].js'
}
})
// Adds cleaning
const CleanWebpackPlugin = require('clean-webpack-plugin')
config.plugins.push(
new CleanWebpackPlugin(['./bundles'])
)
// Adds BundleTracker plugin
const BundleTracker = require('webpack-bundle-tracker')
config.plugins.push(
new BundleTracker({
path: __dirname,
filename: './webpack-stats.json'
})
)
// Adds BundleAnalyzer
if (DEBUG_ANALYZE) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
config.plugins.push(
new BundleAnalyzerPlugin({analyzerPort: 9001})
)
}
module.exports = config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment