forked from keyteki/keyteki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
63 lines (62 loc) · 1.98 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
53
54
55
56
57
58
59
60
61
62
63
const path = require('path');
const webpack = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
resolve: {
extensions: ['.js', '.jsx'],
alias: {
assets: path.resolve('./client/assets')
}
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: './views/index.pug',
inject: true
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
],
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/'
},
optimization: {
moduleIds: 'hashed',
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'all'
}
}
}
},
module: {
rules: [
{
test: /\.jsx?/,
exclude: /[\\/]node_modules[\\/](?!(@sendgrid\/mail|debug|engine.io-client|socket.io-client|cross-env|eslint-config-prettier|eslint-plugin-jest|eslint-plugin-prettier|lint-staged|pg|prettier|socket.io|winston)[\\/])/,
loader: 'babel-loader'
},
{
test: /.(jpe?g|png|woff(2)?|eot|ttf|cur|svg|mp3|ogg)(\?[a-z0-9=.]+)?$/,
use: 'url-loader?limit=16384'
},
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
{ test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
{
test: /\.json/,
exclude: /node_modules/,
type: 'javascript/auto',
use: [require.resolve('json-loader')]
},
{ test: /\.pug$/, include: path.join(__dirname, 'views'), loaders: ['pug-loader'] }
]
}
};