This repository was archived by the owner on Jan 18, 2024. It is now read-only.
forked from Retoxified/GenLite-Old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
55 lines (52 loc) · 1.44 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
const path = require('path');
const webpack = require('webpack');
const fs = require('fs');
const TerserPlugin = require("terser-webpack-plugin");
const METADATA = fs.readFileSync('./userscript-banner.txt', 'utf8');
module.exports = {
mode: 'production',
resolve: {
extensions: ['.ts', '.js', '.json']
},
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/,
},
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
{
test: /\.js$/,
loader: "source-map-loader"
}
]
},
entry: './src/index.ts',
output: {
filename: 'genlite.user.js',
path: path.resolve(__dirname, 'dist'),
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
beautify: false,
preamble: METADATA,
comments: false
},
},
extractComments: true,
})
],
},
plugins: [
new webpack.BannerPlugin({
raw: true,
banner: METADATA
})
]
};