-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.config.js
58 lines (55 loc) · 1.29 KB
/
webpack.dev.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
const path = require('path');
const webpack = require('webpack');
const combineLoaders = require('webpack-combine-loaders');
const htmlWebpackPlugin = require('html-webpack-plugin');
const jsLoader = combineLoaders([
{
loader: 'babel-loader',
query: {
presets: ['es2015', 'stage-0', 'react'],
plugins: ['transform-runtime', 'transform-decorators-legacy']
}
},
{
loader: 'eslint-loader'
}
]);
const Config = {
name: 'client',
devtool: 'sourcemap',
publicPath: 'dist/',
entry: [
'babel-polyfill',
path.resolve(__dirname, 'src/js/index.js')
],
output: {
path: path.resolve(__dirname, 'dist/'),
publicPath: '/dist/',
filename: 'index.js'
},
resolve: {
extensions: ['', '.js', '.jsx'],
modulesDirectories: ['node_modules']
},
module: {
loaders: [
// Process .js and .jsx files:
{
test: /\.jsx?$/,
include: path.resolve(__dirname, 'src/'),
exclude: /(node_modules|bower_components|workers)/,
loader: jsLoader
}
]
},
plugins: [
new htmlWebpackPlugin({
template: 'src/views/index.html',
filename: path.resolve(__dirname, 'index.html'),
inject: 'head',
hash: true
}),
new webpack.optimize.OccurenceOrderPlugin()
]
};
module.exports = Config;