forked from kookxiang/KK-Mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.config.js
64 lines (63 loc) · 2.51 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
59
60
61
62
63
64
var path = require("path");
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: "./index.jsx",
output: {
path: "dist/Resources",
filename: "[name].js",
sourceMapFilename: "[file].map",
publicPath: "/Resources/"
},
resolve: {
extensions: ["", ".js", ".jsx"]
},
module: {
loaders: [
{ test: /\.(sc|sa|c)ss$/, loader: ExtractTextPlugin.extract("style", "css?sourceMap&importLoaders=1&modules&camelCase&localIdentName=[path][name][local]_[hash:base64:6]!postcss!sass") },
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "file?limit=8192&name=Asserts/[hash:hex:6].[ext]&minetype=application/font-woff" },
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "file?limit=8192&name=Asserts/[hash:hex:6].[ext]&minetype=application/font-woff" },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "file?limit=8192&name=Asserts/[hash:hex:6].[ext]&minetype=application/octet-stream" },
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file?name=Asserts/[hash:hex:6].[ext]" },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "file?limit=8192&name=Asserts/[hash:hex:6].[ext]&minetype=image/svg+xml" },
{ test: /\.(jpe?g|gif|png)$/, loader: "file?limit=8192&name=Asserts/[hash:hex:6].[ext]" },
{
test: /\.js|jsx$/,
exclude: /node_modules/,
loader: "babel",
query: {
presets: ["es2015", "react"],
plugins: [
["import", [
{ libraryName: "react-toolbox", style: "sass" },
{ libraryName: "react-router", camel2DashComponentName: false },
]], "add-module-exports", "transform-runtime"
]
}
}
]
},
sassLoader: {
data: "@import \"" + path.resolve(__dirname, "css/_theme.scss") + "\";"
},
postcss: function () {
return [];
},
sourceMap: "cheap-source-map",
plugins: [
new ExtractTextPlugin("[name].css"),
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify("dev")
}),
new webpack.HotModuleReplacementPlugin()
],
devServer:{
inline: true,
hot: true,
port: 8888,
host: "0.0.0.0",
historyApiFallback: {
index: "/index.html"
}
}
};