File tree 2 files changed +11
-2
lines changed
packages/@vue/cli-plugin-router/generator
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ module.exports = (api, options = {}) => {
10
10
11
11
api . render ( './template' , {
12
12
historyMode : options . historyMode ,
13
- doesCompile : api . hasPlugin ( 'babel' ) || api . hasPlugin ( 'typescript' )
13
+ doesCompile : api . hasPlugin ( 'babel' ) || api . hasPlugin ( 'typescript' ) ,
14
+ hasTypeScript : api . hasPlugin ( 'typescript' )
14
15
} )
15
16
16
17
if ( api . invoking ) {
Original file line number Diff line number Diff line change 1
1
import Vue from 'vue'
2
+ < % _ if ( hasTypeScript ) { _ % >
3
+ import VueRouter , { RouteConfig } from 'vue-router'
4
+ < % _ } else { _ % >
2
5
import VueRouter from 'vue-router'
6
+ < % _ } _ % >
3
7
import Home from '../views/Home.vue'
4
8
5
9
Vue . use ( VueRouter )
6
10
7
- const routes = [
11
+ < % _ if ( hasTypeScript ) { _ % >
12
+ const routes : Array < RouteConfig > = [
13
+ < % _ } else { _ % >
14
+ const routes = [
15
+ < % _ } _ % >
8
16
{
9
17
path : '/' ,
10
18
name : 'Home' ,
You can’t perform that action at this time.
0 commit comments