-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
59 lines (58 loc) · 1.39 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
47
48
49
50
51
52
53
54
55
56
57
58
59
const webpack = require('webpack'),
path = require('path'),
SRC_DIR = path.resolve(__dirname, './src')
BUILD_DIR = path.resolve(__dirname, './assets/js'),
MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
plugins: [
new MiniCssExtractPlugin(),
new webpack.ProvidePlugin({
"React": "react",
}),
],
entry: {
index: [
path.resolve(SRC_DIR, 'index.jsx'),
path.resolve(SRC_DIR, 'css/skeleton.css'),
path.resolve(SRC_DIR, 'css/sticky.css'),
path.resolve(SRC_DIR, 'css/style.css'),
],
coursework: path.resolve(SRC_DIR, 'coursework.jsx')
},
output: {
path: BUILD_DIR,
filename: '[name].bundle.js'
},
resolve: {
extensions: ['.js', '.jsx', 'json']
},
module: {
rules: [
{
test: /\.jsx?/,
include: SRC_DIR,
loader: 'babel-loader',
options: {
presets: ['react', 'es2015']
}
},
{
test: /\.css$/i,
// use: [ MiniCssExtractPlugin.loader, 'style-loader', 'css-loader' ],
use: [ MiniCssExtractPlugin.loader, 'css-loader' ],
sideEffects: true
},
{
test: /\.(png|svg|jpg|gif)$/,
use: [
'url-loader?limit=8192'
]
},
{
type: 'javascript/auto',
test: /\.json$/,
use: [ 'json-loader?name=[name].[ext]' ]
}
]
}
};