File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -103,13 +103,21 @@ export default function (ast, info) {
103
103
}
104
104
}
105
105
106
- // import 其他 配置在dependenciesMap的npm包
106
+ // import 配置在dependenciesMap的npm包
107
107
if ( path . type === 'ImportDeclaration' && getWxNpmPackageName ( path . node . source . value ) ) {
108
108
const newV = getWxNpmPackageName ( path . node . source . value )
109
109
path . node . source . value = newV
110
110
return
111
111
}
112
112
113
+ // export {x} from 'xxx'
114
+ if ( path . type === 'ExportNamedDeclaration' && path . node . source && getWxNpmPackageName ( path . node . source . value ) ) {
115
+ const newV = getWxNpmPackageName ( path . node . source . value )
116
+ path . node . source . value = newV
117
+ return
118
+ }
119
+
120
+
113
121
// require 其他 配置在dependenciesMap的npm包
114
122
if ( path . type === 'CallExpression'
115
123
&& path . node . callee . name === 'require'
@@ -171,8 +179,9 @@ export default function (ast, info) {
171
179
}
172
180
173
181
174
- // import 目录, 小程序不支持需要处理
175
- if ( path . type === 'ImportDeclaration' ) {
182
+ // 1. import 目录, 小程序不支持需要处理
183
+ // 2. export {x} from './xxx' 这种情况
184
+ if ( path . type === 'ImportDeclaration' || ( path . type === 'ExportNamedDeclaration' && path . node . source ) ) {
176
185
const source = path . node . source . value
177
186
const rs = getRealSource ( source , filepath )
178
187
path . node . source . value = rs
You can’t perform that action at this time.
0 commit comments