-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.dev.js
80 lines (79 loc) · 2.43 KB
/
webpack.config.dev.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
const path = require('path');
const webpack = require('webpack');
const webpackOnBuildPlugin = require('on-build-webpack');
const replace = require("replace");
const autoprefixer = require('autoprefixer');
module.exports = {
devtool: 'source-map',
entry: {
admin: './client/admin/',
web: './client/web/'
},
output: {
path: path.join(__dirname, 'public'),
filename: '[name]-bundle-[hash].js'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpackOnBuildPlugin((stats) => {
replace({
regex: "(config.bundleHash.+)",
replacement: `config.bundleHash="${stats.hash}";`,
paths: ['./config.js'],
recursive: true,
silent: true,
});
})
],
module: {
rules: [{
test: /\.js$/,
exclude: /(node_modules)/,
use: [{
loader: 'babel-loader',
options: {
presets: ['react'],
plugins: [require('babel-plugin-transform-object-rest-spread')]
}
}]
}, {
test: /\.css$/,
// exclude: /(node_modules)/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1
}
}, {
loader: 'postcss-loader',
options: {
plugins: () => {
return [
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
]
})
];
}
}
}
]
}, {
test: /\.svg$/,
exclude: /(node_modules)/,
use: [{
loader: 'file-loader',
query: {
name: 'static/media/[name]-[hash].[ext]'
}
}]
}]
}
};