Skip to content

Commit 2bce114

Browse files
committed
refactor: update bundling process
1 parent 806aad3 commit 2bce114

2 files changed

Lines changed: 50 additions & 11 deletions

File tree

scripts/create-neutrino-config.js

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -346,39 +346,67 @@ module.exports = function createNeutrinoConfig({
346346
.merge({
347347
splitChunks: {
348348
cacheGroups: {
349-
react: {
350-
test: /[\\/]node_modules[\\/](react|react-dom|i18next)[\\/]/,
351-
name: 'view-vendor',
349+
'vendor-react': {
350+
test: /[\\/]node_modules[\\/](react|react-dom|scheduler|prop-types|object-assign|loose-envify|i18next)[\\/]/,
351+
name: 'vendor-react',
352352
chunks: 'all',
353-
priority: 100
353+
priority: 100,
354+
enforce: true
354355
},
355356
franc: {
356357
test: /[\\/]node_modules[\\/]franc/,
357358
name: 'franc',
358359
chunks: 'all',
359360
priority: 100
360361
},
361-
dexie: {
362+
'vendor-dexie': {
362363
test: /[\\/]node_modules[\\/]dexie/,
363-
name: 'dexie',
364+
name: 'vendor-dexie',
364365
chunks: 'all',
365366
priority: 100
366367
},
368+
'vendor-dompurify': {
369+
test: /[\\/]node_modules[\\/]dompurify[\\/]/,
370+
name: 'vendor-dompurify',
371+
chunks: 'all',
372+
priority: 120,
373+
enforce: true
374+
},
367375
wordpage: {
368376
test: (module, chunks) => module.resource &&
369377
module.resource.includes(`${path.sep}src${path.sep}`) &&
370378
!module.resource.includes(`${path.sep}node_modules${path.sep}`),
371379
name: 'wordpage',
372380
chunks: ({ name }) => /^(notebook|history)$/.test(name),
373381
},
374-
antd: {
382+
'vendor-antd': {
375383
test: /[\\/]node_modules[\\/]/,
376-
name: 'antd',
384+
name: 'vendor-antd',
377385
chunks: ({ name }) => /^(options|notebook|history)$/.test(name),
378386
}
379387
}
380388
},
381389
})
390+
391+
neutrino.config.optimization.minimizer('terser').use({
392+
apply: compiler => {
393+
const TerserPlugin = require('terser-webpack-plugin')
394+
const SourceMapDevToolPlugin = require('webpack/lib/SourceMapDevToolPlugin')
395+
396+
new TerserPlugin({
397+
cache: true,
398+
parallel: true,
399+
sourceMap:
400+
(compiler.options.devtool &&
401+
/source-?map/.test(compiler.options.devtool)) ||
402+
(compiler.options.plugins &&
403+
compiler.options.plugins.some(
404+
plugin => plugin instanceof SourceMapDevToolPlugin
405+
)),
406+
exclude: /(?:^|[\\/])assets[\\/](?:vendor-[\da-z-_]+)\.[\da-f]+\.js(?:\?.*)?$/i
407+
}).apply(compiler)
408+
}
409+
})
382410
}
383411

384412
if (argv.debug) {

src/manifest/firefox.manifest.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,22 @@
33
"options_ui": {
44
"browser_style": false
55
},
6-
"applications": {
6+
"browser_specific_settings": {
77
"gecko": {
88
"id": "saladict@crimx.com",
9-
"strict_min_version": "100.0"
9+
"strict_min_version": "142.0",
10+
"data_collection_permissions": {
11+
"required": [
12+
"searchTerms",
13+
"websiteContent"
14+
],
15+
"optional": [
16+
"authenticationInfo",
17+
"browsingActivity",
18+
"technicalAndInteraction"
19+
]
20+
}
1021
}
1122
},
1223
"content_security_policy": "script-src 'self'; object-src 'self'"
13-
}
24+
}

0 commit comments

Comments
 (0)