-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
57 lines (51 loc) · 1.35 KB
/
webpack.config.js
File metadata and controls
57 lines (51 loc) · 1.35 KB
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
"use strict";
var path = require("path");
var webpack = require("webpack");
var AppCachePlugin = require('appcache-webpack-plugin');
var args = require("minimist")(process.argv.slice(2));
var debug = !(args.production || args.p);
var config = {
target: "web",
entry: [
"!file?name=index.html&context=./src!./src/index.html",
"./src/index.js",
],
output: {
path: path.resolve("dst"),
filename: "bundle.js",
},
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel?stage=0" },
{ test: /\.json$/, loader: "json" },
{ test: /\.css$/, loader: "style!css" },
{ test: /\.less$/, loader: "style!css!less" },
{ test: /\.(eot|gif|svg|ttf|woff2?)(\?.*)?$/, loader: "url?limit=10000" },
{ test: /\.png$/, loader: "url-loader?mimetype=image/png" },
]
},
plugins: [
new webpack.DefinePlugin({
DEBUG: debug,
}),
],
progress: true,
};
if (debug) {
config.output.pathinfo = true;
config.debug = true;
config.devtool = "source-map";
}
else {
// We use a cache manifest only in production mode. In debug mode
// it would interfere with reloads after source changes.
config.plugins.push(
// The cache manifest goes to the hard-wired filename "manifest.appcache".
new AppCachePlugin({
cache: ['.'],
network: ['http://*', 'https://*', '*'],
settings: ["prefer-online"],
})
);
}
module.exports = config;