Skip to content

Commit 2aeb2bf

Browse files
committed
fix(plugin-nprogress): always optimize nprogress with vite
1 parent 5708934 commit 2aeb2bf

File tree

1 file changed

+13
-0
lines changed
  • packages/@vuepress/plugin-nprogress/src

1 file changed

+13
-0
lines changed

packages/@vuepress/plugin-nprogress/src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ export const nprogressPlugin: Plugin<NprogressPluginOptions> = {
77
name: '@vuepress/plugin-nprogress',
88

99
clientAppSetupFiles: path.resolve(__dirname, './clientAppSetup.js'),
10+
11+
onInitialized(app) {
12+
if (app.options.bundler.endsWith('vite')) {
13+
app.options.bundlerConfig.viteOptions = require('vite').mergeConfig(
14+
app.options.bundlerConfig.viteOptions,
15+
{
16+
optimizeDeps: {
17+
include: ['nprogress'],
18+
},
19+
}
20+
)
21+
}
22+
},
1023
}
1124

1225
export default nprogressPlugin

0 commit comments

Comments
 (0)