-
-
Notifications
You must be signed in to change notification settings - Fork 591
/
failing.js
79 lines (70 loc) · 2.02 KB
/
failing.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
const webpack = require('webpack');
const nodeEnvironment = process.env.NODE_ENV;
const config = {
entry: {
lib: "./app/index.js",
email: "./app/email.js"
},
plugins: [
new webpack.DefinePlugin({
INCLUDE_ALL_MODULES: function includeAllModulesGlobalFn(modulesArray, application) {
modulesArray.forEach(function executeModuleIncludesFn(moduleFn) {
moduleFn(application);
});
},
ENVIRONMENT: JSON.stringify(nodeEnvironment)
})
],
output: {
path: __dirname + "/app",
filename: "bundle.js"
},
resolve: {
root: __dirname + "/app"
},
module: {
// preLoaders: [
// { test: /\.js?$/, loader: 'eslint', exclude: /node_modules/ }
// ],
loaders: [
{ test: /\.js$/, exclude: /(node_modules)/, loader: "babel" },
{ test: /\.html/, exclude: [/(node_modules)/, /src\/index\.html/], loader: "html-loader" },
{ test: /\.s?css$/, loader: "style!css!sass" },
{ test: /\.(png|jpg)$/, loader: "url-loader?mimetype=image/png" }
]
},
// extra configuration options.
// eslint: {
// configFile: '.eslintrc.js'
// }
};
switch (nodeEnvironment) {
case "production":
config.plugins.push(new webpack.optimize.UglifyJsPlugin());
case "preproduction":
config.output.path = __dirname + "/dist";
config.plugins.push(new webpack.optimize.DedupePlugin());
config.plugins.push(new webpack.optimize.OccurenceOrderPlugin());
config.output.filename = "[name].js";
config.entry = {
lib: ["./app/index.js", "angular", "lodash"],
email: ["./app/email.js", "angular"]
};
config.devtool = "source-map";
config.output.libraryTarget = "commonjs2";
break;
case "test":
config.entry = "./index.js";
break;
case "development":
config.entry = {
lib: ["./app/index.js", "webpack/hot/dev-server"],
email: ["./app/email.js", "webpack/hot/dev-server"]
};
config.output.filename = "[name].js";
config.devtool = "source-map";
break;
default:
console.warn("Unknown or Undefined Node Environment. Please refer to package.json for available build commands.");
}
module.exports = config;