-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
75 lines (71 loc) · 1.75 KB
/
webpack.config.js
File metadata and controls
75 lines (71 loc) · 1.75 KB
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
import path from 'path';
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
const root = path.resolve(__dirname);
const clientInclude = [
path.join(root, 'src', 'js')
];
const babelQuery = {
presets: [
'babel-preset-es2015',
'babel-preset-stage-0',
'babel-preset-react'
],
'plugins': [
['transform-decorators-legacy'],
['babel-plugin-transform-runtime'],
['babel-plugin-add-module-exports']
]
};
export default {
/*node: {
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
},*/
//target: 'node',
mode: 'development',
devtool: 'source-map',
entry: ['babel-polyfill', path.join(root, 'src', 'js', 'app.jsx')],
output: {
path: path.join(root, 'dist', 'js'),
filename: 'bundle.js'
},
devServer: {
//publicPath: '/',
contentBase: [path.join(root, 'dist')], // Access address /index.html, instead of /dist/index.html
watchContentBase: true,
inline: true,
hot: true
},
module: {
rules: [
{ test: /\.css$/, loader: 'style!css' },
{
test: /\.js[x]?$/,
loader: 'babel',
query: babelQuery,
include: clientInclude,
exclude: /node_modules/
}
]
},
resolveLoader: {
moduleExtensions: ['-loader']
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
_: 'lodash',
assert: 'assert',
utils: ['@jungleford/simple-utils', 'Utils']
}),
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({
template: path.join(root, 'src', 'index.html'),
filename: '../index.html'
}),
new webpack.HotModuleReplacementPlugin()
]
};