This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.cjs
79 lines (77 loc) · 1.66 KB
/
webpack.config.cjs
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
const path = require('path')
const cp = require('copy-webpack-plugin')
const rm = require('remove-files-webpack-plugin')
const sh = require('webpack-shell-plugin-next')
module.exports = {
mode: 'production',
target: 'web',
entry: {
background: './src/background.js',
options: ['./src/options.js', './src/html/options.html'],
content: ['./src/highlighter.js', './src/repo-status.js', './src/css/style.scss']
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
module: {
rules: [
{
test: /\.html$/i,
use: [
{
loader: 'file-loader',
options: {
name: '[name].html'
}
}
]
},
{
test: /\.scss$/,
use: [
{
loader: 'file-loader',
options: {
name: 'content.css'
}
},
{
loader: 'sass-loader'
}
]
}
]
},
plugins: [
new rm({
before: {
include: ['./build', './dist']
}
}),
new cp({
patterns: [
{from: './src/manifest.json'},
{from: './license'},
{from: './.github/privacy.md', to: 'privacy.md'},
{
from: './src/icons',
to: 'icons/',
globOptions: {
ignore: ['**/.DS_Store']
}
}
]
}),
new sh({
onBuildEnd: {
scripts: [
'mkdir build/',
'./node_modules/.bin/crx3 -p key.pem -z ./build/github-helper.zip -o ./build/github-helper.crx ./dist/'
],
blocking: false,
parallel: true
}
})
]
}