forked from cmfcmf/Anno2018
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.common.js
More file actions
81 lines (80 loc) · 2.24 KB
/
webpack.common.js
File metadata and controls
81 lines (80 loc) · 2.24 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
const path = require("path");
const webpack = require("webpack");
const GitRevisionPlugin = require("git-revision-webpack-plugin");
const gitRevisionPlugin = new GitRevisionPlugin({
// branch: true,
});
const CopyWebpackPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
module.exports = {
entry: {
app: ["idb.filesystem.js", "@babel/polyfill", "./src/index.ts"]
},
module: {
rules: [
{
exclude: /node_modules/,
test: /\.tsx?$/,
use: [
{
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"]
}
},
{
loader: "ts-loader",
options: {
transpileOnly: true
}
}
]
}
]
},
// Extract webpack and vendor code into separate files
// https://webpack.js.org/guides/caching/#extracting-boilerplate
optimization: {
// Move webpack runtime data into separate file
runtimeChunk: "single",
// Move all vendor code into separate file
splitChunks: {
cacheGroups: {
vendor: {
chunks: "all",
name: "vendors",
test: /[\\/]node_modules[\\/]/
}
}
}
},
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist"),
},
plugins: [
gitRevisionPlugin,
new webpack.DefinePlugin({
__VERSION__: JSON.stringify(gitRevisionPlugin.version())
// '__COMMITHASH__': JSON.stringify(gitRevisionPlugin.commithash()),
// '__BRANCH__': JSON.stringify(gitRevisionPlugin.branch()),
}),
new CopyWebpackPlugin([
{ from: "./node_modules/smk2mp4/demo/ffmpeg.js", to: "ffmpeg.js" },
{ from: "./node_modules/smk2mp4/demo/ffmpeg.js.mem", to: "ffmpeg.js.mem" }
]),
new HtmlWebpackPlugin({
meta: {
"apple-mobile-web-app-capable": "yes",
viewport:
"initial-scale=1, maximum-scale=1, user-scalable=no, minimum-scale=1, width=device-width, height=device-height"
},
title: "Anno 2018"
}),
new ForkTsCheckerWebpackPlugin()
],
resolve: {
extensions: [".tsx", ".ts", ".js"]
}
};