-
Notifications
You must be signed in to change notification settings - Fork 136
/
webpack.local.config.js
60 lines (51 loc) · 1.59 KB
/
webpack.local.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
// development config
var webpack = require('webpack');
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
// Where to listen for the dev server
var port = process.env.PORT || 8080;
// For more information, see: http://webpack.github.io/docs/configuration.html
module.exports = {
port: port,
// Efficiently evaluate modules with source maps
devtool: "eval",
// Set entry point to ./src/main and include necessary files for hot load
entry: [
"webpack-dev-server/client?http://0.0.0.0:" + port,
"webpack/hot/only-dev-server",
"./src/main"
],
// This will not actually create a bundle.js file in ./build. It is used
// by the dev server for dynamic hot loading.
output: {
path: __dirname + "/build/",
filename: "app.js",
publicPath: "/"
},
// Transform source code using Babel and React Hot Loader
module: {
loaders: [{
test: /\.jsx?$/,
include: path.join(__dirname, "src"),
loaders: ["react-hot", "babel-loader"]
}, {
test: /\.less$/,
loader: ExtractTextPlugin.extract('css!less')
}, {
test: /\.(woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=1&name=[name].[ext]'
}]
},
// Necessary plugins for hot load
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
// extract inline css into separate 'styles.css'
new ExtractTextPlugin('styles.css', {allChunks: true}),
new webpack.optimize.DedupePlugin()
],
// Automatically transform files with these extensions
resolve: {
extensions: ['', '.js', '.jsx']
}
};