-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.base.js
69 lines (66 loc) · 2.44 KB
/
webpack.config.base.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
const webpack = require('webpack')
const path = require('path')
const ExtractCSS = require('extract-text-webpack-plugin')
// Define client source path
const sources = path.join(__dirname, './client')
// Default config
const config = {
entry: './index.js',
target: 'web',
context: sources,
node: {
global: true,
fs: 'empty'
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
include: sources,
babelrc: false,
query: {
cacheDirectory: true,
plugins: [
"transform-decorators-legacy", // Required for @connect and other decorators
"transform-class-properties", // Required for class props ( ex: see childContextTypes in Context.jsx )
"add-module-exports", // A way to get rid of insanity of require('xx').default
// ES2015 stuff ---
"transform-es2015-modules-commonjs",
"transform-es2015-arrow-functions",
"transform-es2015-block-scoping",
"transform-es2015-block-scoped-functions",
"transform-es2015-classes",
"transform-es2015-computed-properties",
"transform-es2015-destructuring",
"transform-es2015-literals",
"transform-es2015-template-literals",
"transform-es2015-parameters",
"transform-es2015-shorthand-properties",
"transform-es2015-spread",
// React ---
"transform-react-jsx",
]
}
},
{
test: /\.(css|scss)(\?.+)?$/,
loader: ExtractCSS.extract(['css', 'sass']),
include: path.join(sources, 'assets')
}
]
},
output: {
path: path.resolve(__dirname, '.', 'public'),
filename: 'bundle.js',
publicPath: "/",
},
plugins: [
//new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), // If you don't need moment's locales
new ExtractCSS('bundle.css', { allChunks: true }),
new webpack.DefinePlugin({
'process.env.IS_CLIENT': true,
})
]
}
module.exports = config