Skip to content

Commit e4f2f18

Browse files
committed
refactor($pwa): using define API.
1 parent ade62c9 commit e4f2f18

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

packages/@vuepress/plugin-pwa/index.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ module.exports = (options, context) => ({
88
}, options)
99
},
1010

11-
chainWebpack (config) {
11+
define () {
1212
const { serviceWorker, updatePopup } = options
1313
const base = context.base || '/'
14-
15-
config.plugin('injections').tap(([options]) => [
16-
Object.assign(options, {
17-
SW_BASE_URL: JSON.stringify(base),
18-
SW_ENABLED: !!serviceWorker,
19-
SW_UPDATE_POPUP: updatePopup ? JSON.stringify(updatePopup) : false
20-
})
21-
])
14+
return {
15+
SW_BASE_URL: base,
16+
SW_ENABLED: !!serviceWorker,
17+
SW_UPDATE_POPUP: updatePopup || false
18+
}
2219
},
2320

2421
// TODO support components option

0 commit comments

Comments
 (0)