-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
60 lines (59 loc) · 1.47 KB
/
Copy pathwebpack.config.js
File metadata and controls
60 lines (59 loc) · 1.47 KB
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
const path = require('path');
const webpack = require('webpack');
module.exports = {
target: 'web',
entry: {
app: [
'react-hot-loader/patch',
'./src/frameworks/entry.js',
'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=true',
],
},
output: {
path: path.resolve(__dirname, 'public'),
filename: '[name].js',
publicPath: '/',
},
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader',
exclude: [/node_modules/],
},
{
test: /\.less$/,
use: ['style-loader', 'css-loader', 'less-loader'],
},
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
// css modules: .src-style-home_testBQKTT
localIdentName: '[path][name]_[local][hash:base64:5]',
},
},
],
},
{
test: /\.(png|jpg|svg)$/, use: 'url-loader?mimetype=image/png',
},
{
test: /\.(woff|woff2|eot|ttf|svg)($|\?)/,
loader: 'url-loader?limit=1&hash=sha512&digest=hex&size=16&name=resources/[hash].[ext]',
},
],
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
minChunks: module => module.context && module.context.includes('node_modules'),
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
],
};