File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ function parseConfig (babel) {
71
71
function createMPParser ( ) {
72
72
return {
73
73
visitor : {
74
+ // 将import Vue from 'vue' 替换为 import {Vue, createMP} from 'vue'
74
75
ImportDeclaration : function ( path ) {
75
76
if ( path . node . specifiers && path . node . source && path . node . source . value === 'vue' ) {
76
77
const specifiersValue = path . node . specifiers [ 0 ] . local . name
@@ -80,6 +81,13 @@ function createMPParser () {
80
81
]
81
82
}
82
83
} ,
84
+ // 处理const app = new Vue
85
+ // 构造为 createMp({
86
+ // mpType: App.mpType,
87
+ // init(){
88
+ // return new Vue(App)
89
+ // }
90
+ // })
83
91
VariableDeclaration : function ( path ) {
84
92
if ( path . node . declarations &&
85
93
t . isVariableDeclarator ( path . node . declarations [ 0 ] ) &&
@@ -126,6 +134,7 @@ function createMPParser () {
126
134
) )
127
135
}
128
136
} ,
137
+ // main.js中app.$mount()移除掉
129
138
ExpressionStatement : function ( path ) {
130
139
if (
131
140
path . parentPath . node . type === 'Program' &&
You can’t perform that action at this time.
0 commit comments