-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
79 lines (77 loc) · 2.26 KB
/
webpack.config.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
/* eslint-disable */
const path = require("path");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const GenerateJsonPlugin = require("generate-json-webpack-plugin");
const GitRevisionPlugin = require("git-revision-webpack-plugin");
const dotenv = require('dotenv').config({ path: __dirname + '/.env' });
const { DefinePlugin } = require("webpack");
const gitRevisionPlugin = new GitRevisionPlugin();
module.exports = {
entry: `./lib/main/Gather.js`,
output: {
path: path.join(__dirname, "dist"),
filename: "Gather.js",
chunkFilename: "[name].js?m=[chunkhash]"
},
mode: "development",
resolve: {
symlinks: false,
mainFields: ["browser", "main", "module"]
},
node: {
fs: "empty"
},
devServer: {
host: "0.0.0.0",
port: 8000,
disableHostCheck: true,
watchOptions: {
ignored: [
path.resolve(__dirname, "src/**/*.ts")
]
},
},
devtool: "source-map",
stats: {
warningsFilter: /System.import/
},
performance: {
maxAssetSize: 16777216,
maxEntrypointSize: 16777216
},
module: {
rules: [
{
test: /\.js$/,
include: [
path.resolve(__dirname, "lib")
],
use: ["source-map-loader"],
enforce: "pre"
}
]
},
plugins: [
new DefinePlugin({
"process.env": JSON.stringify({...process.env, ...dotenv.parsed})
}),
gitRevisionPlugin,
new GenerateJsonPlugin("appinfo.json", {
version: process.env.npm_package_version,
gitCommitHash: gitRevisionPlugin.commithash()
}),
new CopyWebpackPlugin({ patterns: [
//{ from: "src/demo/**/*.{html,css}" },
{ from: "assets/", to: "assets/" },
{ from: "index.html", transform(content) {
return content.toString().replace("src=\"node_modules/steal/steal.js\" main=\"lib/main/Gather\"",
"src=\"Gather.js\"");
}},
{ from: "style.css" },
{ from: "manifest.webmanifest" }
]})
],
optimization: {
minimize: true
}
};