-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.common.js
50 lines (48 loc) · 1.07 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
const path = require('path')
const BundleTracker = require('webpack-bundle-tracker')
const webpack = require('webpack')
module.exports = {
context: __dirname,
entry: ['./assets/js/index'],
output: {
path: path.resolve('./assets/bundles/'),
filename: '[name]-[hash].js'
},
plugins: [
new BundleTracker({ filename: './webpack-stats.json' }),
new webpack.LoaderOptionsPlugin({ options: {} })
],
module: {
rules: [
{
test: /\.(js|jsx|mjs)$/,
exclude: /node_modules/,
enforce: 'pre',
use: [
{
loader: require.resolve('eslint-loader')
}
],
include: path.resolve('assets/js')
},
// we pass the output from babel loader to react-hot loader
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader'
}
]
},
{
test: /\.svg$/,
loader: 'svg-sprite-loader'
}
]
},
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.jsx']
}
}