-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-dev.config.js
57 lines (56 loc) · 2.01 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
var path = require("path");
var webpack = require("webpack");
var HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
devtool: "eval",
entry: {
app: [
"webpack-dev-server/client?http://localhost:3000",
"webpack/hot/only-dev-server",
path.join(__dirname, "src/app/App.jsx")
],
vendor: [ "react", "react-dom" ]
},
node: {
fs: "empty"
},
resolve: {
// When requiring, you don"t need to add these extensions
extensions: ["", ".js", ".jsx"],
alias: {
"react": path.resolve(__dirname, "node_modules/react"),
"react-dom": path.resolve(__dirname, "node_modules/react-dom"),
"react-router": path.resolve(__dirname, "node_modules/react-router"),
"assets": path.resolve(__dirname, "src/assets")
},
root: path.resolve(__dirname, "src/app")
},
output: {
path: path.join(__dirname, "build"),
filename: "main.js",
publicPath: "/"
},
plugins: [
new webpack.optimize.CommonsChunkPlugin("vendor", "vendor.js"),
new HtmlWebpackPlugin({
inject: true,
template: path.join(__dirname, "src/public/index.html")
}),
new webpack.HotModuleReplacementPlugin()
],
module: {
loaders: [
{ test: /\.css$/, loader: "style-loader!css-loader" },
{ test: /\.(js|jsx)$/, loaders: [ "react-hot", "babel-loader" ],
include: [ path.join(__dirname, "src") ] },
{ test: /\.less$/, loader: "style!css!less" },
{ test: /\.json$/, loader: "json-loader" },
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" },
{ test: /\.(png|jpg|jpeg|gif)?$/, loader: "file" },
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" }
]
}
};