/
webpack.prod-demo.js
38 lines (34 loc) · 1.23 KB
/
webpack.prod-demo.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
const merge = require("webpack-merge")
const webpack = require("webpack")
const path = require("path")
const AppCachePlugin = require("appcache-webpack-plugin")
const CleanWebpackPlugin = require("clean-webpack-plugin")
const HtmlWebpackPlugin = require("html-webpack-plugin")
const common = require("./webpack.common.js")
module.exports = merge(common, {
output: {
filename: "app.[contenthash].js",
path: path.resolve(__dirname, "dist", "demo-web")
},
mode: "production",
plugins: [
// Creates the HTML files
new HtmlWebpackPlugin({
title: "Flappy Royale",
meta: { viewport: "width=160, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" },
production: true,
template: "src/index.template"
}),
// It seems odd we're stringifying instead of just inlining `true`, but this is actually necessary!
new webpack.DefinePlugin({
PRODUCTION: JSON.stringify(true),
DEMO: JSON.stringify(true)
}),
new CleanWebpackPlugin(),
new AppCachePlugin({
network: ["*"],
settings: ["prefer-online"],
output: "manifest.appcache"
})
]
})