Skip to content

Commit 96f1410

Browse files
authored
fix:worker load (#3559)
1 parent 0e5303c commit 96f1410

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

config/custom-docusaurus-plugin.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,24 @@ module.exports = function (context, options) {
44
return {
55
name: 'custom-docusaurus-plugin',
66
configureWebpack(config, isServer, utils) {
7+
const localePublicPath =
8+
context.i18n.currentLocale === 'en'
9+
? '/'
10+
: context.i18n.currentLocale === 'zh-CN'
11+
? '/zh-CN/'
12+
: '/ja/';
13+
714
return {
815
output: {
916
...config.output,
1017
publicPath:
1118
context.i18n.currentLocale === 'en'
1219
? 'https://cdnd.selectdb.com/' :
1320
context.i18n.currentLocale === 'zh-CN' ?
14-
'https://cdnd.selectdb.com/zh-CN/' : 'https://cdnd.selectdb.com/ja/'
21+
'https://cdnd.selectdb.com/zh-CN/' : 'https://cdnd.selectdb.com/ja/',
22+
// Keep general assets on CDN, but force worker chunks to same-origin
23+
// to satisfy browser worker same-origin policy for Search worker bootstrap.
24+
workerPublicPath: localePublicPath,
1525
},
1626
};
1727
},

0 commit comments

Comments
 (0)