Created
October 21, 2021 13:01
-
-
Save frague59/ee2a604a90459052ba45d56b672889fd to your computer and use it in GitHub Desktop.
Dev settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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