File tree 2 files changed +25
-8
lines changed
2 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import dataMixin from './dataMixin'
6
6
import NotFound from '@notFound'
7
7
import { routes } from '@temp/routes'
8
8
import { siteData } from '@temp/siteData'
9
+ import enhanceApp from '@temp/enhanceApp'
9
10
10
11
// suggest dev server restart on base change
11
12
if ( module . hot ) {
@@ -64,14 +65,20 @@ export function createApp () {
64
65
}
65
66
} )
66
67
67
- const app = new Vue ( {
68
- router,
69
- render ( h ) {
70
- return h ( 'div' , { attrs : { id : 'app' } } , [
71
- h ( 'router-view' , { ref : 'layout' } )
72
- ] )
73
- }
74
- } )
68
+ const options = { }
69
+
70
+ enhanceApp ( { Vue, options, router } )
71
+
72
+ const app = new Vue (
73
+ Object . assign ( options , {
74
+ router,
75
+ render ( h ) {
76
+ return h ( 'div' , { attrs : { id : 'app' } } , [
77
+ h ( 'router-view' , { ref : 'layout' } )
78
+ ] )
79
+ }
80
+ } )
81
+ )
75
82
76
83
return { app, router }
77
84
}
Original file line number Diff line number Diff line change @@ -50,6 +50,16 @@ if (!Object.assign) Object.assign = require('object-assign')`
50
50
await writeTemp ( `override.styl` , hasUserOverride ? `@import(${ JSON . stringify ( overridePath ) } )` : `` )
51
51
}
52
52
53
+ // 6. handle enhanceApp.js
54
+ const enhancePath = path . resolve ( sourceDir , '.vuepress/enhanceApp.js' )
55
+ const hasEnhancePath = fs . existsSync ( enhancePath )
56
+ await writeTemp (
57
+ 'enhanceApp.js' ,
58
+ hasEnhancePath
59
+ ? `export { default } from ${ JSON . stringify ( enhancePath ) } `
60
+ : `export default function () {}`
61
+ )
62
+
53
63
return options
54
64
}
55
65
You can’t perform that action at this time.
0 commit comments