generated from Liinkiing/react-extension-webpack-typescript-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.ts
28 lines (27 loc) · 881 Bytes
/
webpack.prod.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
import { optimize } from 'webpack'
import merge from 'webpack-merge'
import common, { build, src } from './webpack.common'
import CopyWebpackPlugin from 'copy-webpack-plugin'
import path from 'path'
export default merge.smart(common, {
mode: 'production',
plugins: [
new CopyWebpackPlugin([
{
from: path.join(path.resolve(src, '..'), 'manifest.json'),
to: path.join(build, 'manifest.json'),
toType: 'file',
transform(content) {
const manifest = JSON.parse((content as unknown) as string)
manifest.content_security_policy = (manifest.content_security_policy as string).replace(
'ws://localhost:* ',
''
)
return Buffer.from(JSON.stringify(manifest))
}
}
]),
new optimize.AggressiveMergingPlugin(),
new optimize.OccurrenceOrderPlugin(true)
]
})