-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.config.js
46 lines (44 loc) · 1.08 KB
/
webpack.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
const webpack = require('webpack');
// Init common paths used by config
const path = require('path');
const PATHS = {
app: path.join(__dirname, 'src'),
build: path.join(__dirname, 'public'),
stylesheets: path.join(__dirname, 'src/style', 'style.scss')
};
// Standard build artifacts for all envs
module.exports = {
entry: {
app: PATHS.app,
style: PATHS.stylesheets
},
output: {
path: PATHS.build,
filename: '[name].js'
},
module: {
rules: [
{ // Convert React code into vanilla ES5
test: /jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{ // Transpile SASS and load CSS
test: /\.s?css$/,
use: [ 'style-loader', 'css-loader', 'sass-loader' ],
include: PATHS.stylesheets
},
{ // Transfer static files to build
test: /\.(png)$/,
loader: 'file-loader?name=images/[name].[ext]'
},
{ // Inline SVGs where required in components
test: /\.svg$/,
use: [
'babel-loader',
'svg-react-loader'
]
}
]
}
}