-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
62 lines (59 loc) · 1.5 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
62
const
path = require("path"),
ExtractTextPlugin = require("extract-text-webpack-plugin"),
CopyWebpackPlugin = require("copy-webpack-plugin"),
webpack = require("webpack");
const
srcDir = path.join(__dirname, "src"),
appDir = path.join(__dirname, "build");
var cfg = {
devServer: {
inline: true,
proxy: {
"*": {
target: "http://localhost:3000/",
secure: false,
},
},
},
entry: srcDir + "/index.js",
output: {
path: appDir,
filename: "js/bundle.js",
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin("[name].css"),
new CopyWebpackPlugin([
{ from: srcDir + "/js/ext", to: appDir + "/js" },
{ from: srcDir + "/index.html", to: appDir + "/index.html" },
{ from: srcDir + "/assets/icons", to: appDir + "/build/" },
{ from: srcDir + "/assets/fonts", to: appDir + "/fonts" },
{ from: __dirname + "/app.js", to: appDir + "/app.js" },
{ from: __dirname + "/package.json", to: appDir + "/package.json" },
]),
],
module: {
loaders: [{
test: /\.js$/,
include: srcDir,
loaders: ["babel"],
},{
test: /\.s[ac]ss$/,
loaders: ["style", "css", "sass"],
},{
test: /\.(eot|svg|ttf|woff|woff2)(\?\w+)?$/,
loader: "file?name=fonts/[name].[ext]",
}],
},
resolve: {
extensions: ["", ".js", ".scss", ".sass"],
root: [srcDir],
},
target: "electron",
node: {
__dirname: false,
__filename: false,
},
};
module.exports = cfg;