forked from otech47/setmine-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
61 lines (60 loc) · 1.38 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
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
module.exports = {
entry: {
setmine: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server',
'./src/index.jsx'
]
},
devtool: '#cheap-module-eval-source-map',
devServer: {
contentBase: './public', // where webpack-dev-server should look for static files
historyApiFallback: true,
colors: true,
hot: true
},
output: {
path: path.resolve(__dirname, 'public'), // where webpack saves bundled files
filename: '[name]-bundle.js', // name of output file
},
resolve: {
extensions: ['', '.jsx', '.js', '.less'],
moduleDirectories: ['node_modules']
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index-dev.html',
inject: 'body'
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.ProvidePlugin({
'Promise': 'exports?global.Promise!es6-promise',
'fetch': 'exports?self.fetch!whatwg-fetch'
})
],
module: {
loaders: [
{
test: /\.(js|jsx)$/,
loaders: ['react-hot', 'babel'], // plugins & presets in .babelrc file
include: [
path.resolve(__dirname, 'src')
],
exclude: /node_modules/
},
{
test: /\.less$/,
loader: 'style!css!less',
exclude: /node_modules/
},
{
test: /\.(png|jpeg|svg)$/,
loader: 'file',
exclude: /node_modules/
}
]
}
};