-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.base.config.js
71 lines (69 loc) · 2.06 KB
/
webpack.base.config.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
const path = require('path');
const webpack = require('webpack');
const ROOT_PATH = path.resolve(__dirname);
const SRC_PATH = path.resolve(ROOT_PATH, 'src');
const BUILD_PATH = path.resolve(ROOT_PATH, 'build');
module.exports = {
entry: {
index: path.resolve(SRC_PATH, 'index.jsx')
},
output: {
path: BUILD_PATH,
filename: 'js/[name].[hash:5].js'
},
resolve: {
extensions: ['.js', '.jsx', '.json', '.scss', '.css']
},
module: {
loaders: [
{
test: /\.jsx?$/,
loaders: ['eslint-loader'],
include: SRC_PATH,
enforce: 'pre'
}, {
test: /\.jsx?$/,
loaders: ['babel-loader'],
include: SRC_PATH,
exclude: path.resolve(ROOT_PATH, 'node_modules')
}, {
test: /\.css$/,
loader: 'style-loader!css-loader',
}, {
test: /\.scss$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]__[local]-[hash:5]',
importLoaders: 3,
},
},
'sass-loader',
],
}, {
test: /\.(png|jpg|gif|svg)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 8192,
name: 'images/[name].[hash:5].[ext]',
},
},
],
}, {
test: /\.json$/,
loader: 'json-loader',
}
]
},
plugins: [
new webpack.DllReferencePlugin({
manifest: require(path.resolve(ROOT_PATH, 'lib', 'manifest.json')),
context: ROOT_PATH,
})
]
};