-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathwebpack.config.js
49 lines (45 loc) · 1.14 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
const { resolve, join } = require('path');
const { readFileSync } = require('fs');
const { BannerPlugin } = require('webpack');
const CreateFilePlugin = require('create-file-webpack');
const { version } = require('./package.json');
const META = readFileSync(join(__dirname, 'assets', 'meta.in.js'), 'utf-8')
.replace('{{version}}', version);
const MANIFEST = readFileSync(join(__dirname, 'assets', 'manifest.in.json'), 'utf-8')
.replace('{{version}}', version);
module.exports = {
mode: 'none',
entry: [
'./src/index.ts',
],
plugins: [
new BannerPlugin({ banner: META, raw: true }),
new CreateFilePlugin({
path: resolve(__dirname, 'dist'),
fileName: 'awsl.meta.js',
content: META,
}),
new CreateFilePlugin({
path: resolve(__dirname, 'dist'),
fileName: 'manifest.json',
content: MANIFEST,
}),
],
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
output: {
filename: 'awsl.user.js',
path: resolve(__dirname, 'dist'),
clean: true,
},
};