Skip to content

Commit 14e0df7

Browse files
authored
Merge pull request #28 from adambullmer/performance-filter
Added asset filtering on zip files and icons.
2 parents f20d849 + 34bbdd7 commit 14e0df7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ const defaultOptions = {
1111
manifestSync: ['version'],
1212
modesToZip: ['production']
1313
}
14+
const performanceAssetFilterList = [
15+
(file) => !(/\.map$/.test(file)),
16+
(file) => !file.endsWith('.zip'),
17+
(file) => !(/^icons\//.test(file))
18+
]
1419

1520
module.exports = (api, options) => {
1621
const appRootPath = api.getCwd()
@@ -47,6 +52,11 @@ module.exports = (api, options) => {
4752
webpackConfig.output.chunkFilename = 'js/[id].[name].js'
4853
webpackConfig.node.global = false
4954

55+
if (webpackConfig.performance === undefined) {
56+
webpackConfig.performance = {}
57+
}
58+
webpackConfig.performance.assetFilter = (assetFilename) => performanceAssetFilterList.every((filter) => filter(assetFilename))
59+
5060
if (pluginOptions.autoImportPolyfill) {
5161
webpackConfig.plugins.push(new webpack.ProvidePlugin({
5262
'browser': 'webextension-polyfill'

0 commit comments

Comments
 (0)