-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
52 lines (51 loc) · 1.47 KB
/
webpack.common.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* eslint-disabled */
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const path = require('path')
// Common configuration, with extensions in webpack.dev.js and webpack.prod.js.
module.exports = {
bail: true,
context: __dirname,
entry: {
main: './assets/js/app.js',
},
module: {
rules: [
{
test: /\.(sass|css|scss)$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
output: {
chunkFilename: 'theme-bundle.chunk.[name].js',
filename: 'theme-bundle.[name].js',
path: path.resolve(__dirname, 'assets/dist'),
},
performance: {
hints: 'warning',
maxAssetSize: 1024 * 300,
maxEntrypointSize: 1024 * 300,
},
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['assets/dist'],
verbose: false,
watch: false,
}),
new LodashModuleReplacementPlugin({
collections: true,
currying: true,
placeholders: true,
shorthands: true,
}),
new BundleAnalyzerPlugin({
analyzerMode: 'static',
openAnalyzer: false,
}),
],
resolve: {
fallback: { url: require.resolve('url/') },
},
}