-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.config.js
54 lines (51 loc) · 1.29 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
const path = require('path');
const { UserscriptPlugin } = require('webpack-userscript');
var config = {
entry: './src/index.ts',
externals: {
'he': 'he',
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
mode: 'production',
optimization: {
minimize: false,
},
output: {
filename: 'lastfm-bulk-edit.js',
path: path.resolve(__dirname, 'dist'),
},
plugins: [
new UserscriptPlugin({
headers: {
name: 'Last.fm Bulk Edit',
match: 'https://www.last.fm/*',
icon: 'https://raw.githubusercontent.com/RudeySH/lastfm-bulk-edit/main/img/icon.png',
license: 'AGPL-3.0-or-later',
namespace: 'https://github.com/RudeySH/lastfm-bulk-edit',
require: [
'https://cdnjs.cloudflare.com/ajax/libs/he/1.2.0/he.min.js',
],
},
downloadBaseURL: 'https://raw.githubusercontent.com/RudeySH/lastfm-bulk-edit/main/dist/',
}),
],
};
module.exports = (env, argv) => {
if (argv.mode === 'development') {
config.devtool = 'inline-source-map';
config.output.path = path.resolve(__dirname, 'dist', 'development');
config.watch = true;
}
return config;
};