-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.config.js
99 lines (90 loc) · 2.12 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
const { DefinePlugin } = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const BabiliPlugin = require('babili-webpack-plugin');
const path = require('path');
module.exports = {
context: __dirname,
entry: path.join(__dirname, 'src', 'index.jsx'),
output: {
path: path.join(__dirname, 'assets'),
filename: 'app.bundle.js',
},
devtool: 'source-map',
resolve: {
extensions: [
'.js',
'.json',
'.jsx',
],
modules: [
path.join(__dirname, 'src'),
'node_modules',
],
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
cacheDirectory: true,
babelrc: false,
// babel configurations
presets: [
[
'env',
{
targets: {
browsers: [
'last 1 version',
'not ie <= 11',
'not ie_mob <= 11',
],
},
modules: false,
exclude: ['transform-async-to-generator'],
debug: true,
},
],
'react',
],
plugins: [
'transform-object-rest-spread',
'transform-class-properties',
'async-to-promises',
'transform-runtime',
],
},
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: [
{
loader: 'css-loader',
query: {
modules: true,
importLoaders: 1,
sourceMap: true,
},
},
{
loader: 'postcss-loader',
},
],
}),
},
],
},
plugins: [
new ExtractTextPlugin('app.bundle.css'),
new DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
new BabiliPlugin({
mangle: { topLevel: true },
}),
],
};