Skip to content

Commit 04fde16

Browse files
authored
Merge pull request #452 from messenjer/fix/deprecatd-vuepress-plugin-config
fix(docs): load the component reference inside the plugin
2 parents a58e302 + 75b30ff commit 04fde16

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {defineClientConfig} from '@vuepress/client'
2+
import ReferenceSection from './client/components/reference-section'
3+
import {h} from 'vue'
4+
5+
export default defineClientConfig({
6+
async enhance({app, router, siteData}) {
7+
if (!__VUEPRESS_SSR__) {
8+
// wrap the `<ComponentReference />` component with plugin options
9+
app.component('ComponentReference', (props) => h(ReferenceSection, {}))
10+
}
11+
},
12+
setup() {},
13+
rootComponents: [],
14+
})

docs/.vuepress/PluginComponentReference/client/clientAppEnhance.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/.vuepress/PluginComponentReference/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const componentReference: Plugin<ComponentReferenceOptions> = ({
2323
baseDir = 'component-references',
2424
}) => ({
2525
name: 'plugin-object',
26-
clientAppEnhanceFiles: path.resolve(__dirname, './client/clientAppEnhance.ts'),
26+
clientConfigFile: path.resolve(__dirname, './client.ts'),
2727
extendsPage(page, app: App) {
2828
const {filePath} = resolvePageComponentReferencePath(baseDir, page, app)
2929
let componentReference = null

docs/.vuepress/client.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {defineClientConfig} from '@vuepress/client'
22
import 'bootstrap/scss/bootstrap.scss'
33
import 'bootstrap-vue-3/dist/bootstrap-vue-3.css'
44
import DocReference from './components/DocReference.vue'
5-
import ReferenceSection from './PluginComponentReference/client/components/reference-section'
65
import {h} from 'vue'
76

87
export default defineClientConfig({
@@ -12,7 +11,6 @@ export default defineClientConfig({
1211
app.use(BootstrapVue3)
1312
app.use(BToastPlugin)
1413
app.component('doc-reference', DocReference)
15-
app.component('ComponentReference', (props) => h(ReferenceSection, {}))
1614
}
1715
},
1816
setup() {},

0 commit comments

Comments
 (0)