-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
57 lines (54 loc) · 1.48 KB
/
webpack.config.ts
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
import path from 'path'
import { Configuration } from 'webpack'
import CopyWebpackPlugin from 'copy-webpack-plugin'
import { version, name, description } from './package.json'
const config: Configuration = {
context: path.join(__dirname, 'src'),
entry: {
popup: './popup/index.ts',
options: './options/index.ts',
background: './background/index.ts',
content: './content/index.ts'
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js'
},
module: {
rules: [
{
test: /.ts$/,
use: 'ts-loader',
exclude: '/node_modules/'
}
]
},
resolve: {
extensions: ['.ts', '.js']
},
plugins: [
new CopyWebpackPlugin({
patterns:
[
{ from: 'icons', to: 'icons' },
{ from: 'popup/index.html', to: 'popup/index.html' },
{ from: 'popup/style.css', to: 'popup/style.css' },
{ from: 'options/index.html', to: 'options/index.html' },
{ from: 'options/style.css', to: 'options/style.css' },
{
from: 'manifest.json',
to: 'manifest.json',
transform: (content) => {
const jsonContent = JSON.parse(content.toString())
jsonContent.version = version
jsonContent.name = name
jsonContent.description = description
return JSON.stringify(jsonContent, null, 2)
}
}
// { from: '_locales', to: '_locales' } // i18n file
]
})
]
}
export default config