-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathwebpack.config.prod.js
55 lines (49 loc) · 1.29 KB
/
webpack.config.prod.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
const path = require("path");
const webpack = require("webpack");
const NODE_ENV = process.env.NODE_ENV;
var commonsPlugin = new webpack.optimize.CommonsChunkPlugin({ name: "common" });
var maxChunks = new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 15 });
var minSize = new webpack.optimize.MinChunkSizePlugin({ minChunkSize: 10000 });
//const distRootPath = path.resolve(__dirname, "../../", "/.tmp/public/js/dist");
var loaders = [
{
test: /\.js?$/,
exclude: /(node_modules|bower_components)/,
loaders: ["babel-loader"]
},
{
test: /\.json$/,
loader: "json-loader"
}
];
var extensions = [".js", ".json"];
var ignoreModules = {
fs: "empty",
tls: "empty",
dns: "empty",
net: "empty",
console: true
};
const webpackConfig = {
entry: [path.resolve(__dirname, "./assets/frontend/app.js")],
output: {
path: path.resolve(__dirname, "./.tmp/public/js/dist"),
filename: "frontend.js",
publicPath: "/js/dist/"
},
module: {
loaders: loaders
},
resolve: {
extensions: extensions
},
node: ignoreModules,
plugins: [
new webpack.DefinePlugin({
__ENV__: NODE_ENV
}),
maxChunks,
minSize
]
};
module.exports = webpackConfig;