提交 8b3d8a85 编写于 作者: fxy060608's avatar fxy060608

fix(easycom): maybeSelfReference

上级 aeb959cf
export const PUBLIC_DIR = 'static'
export const EXTNAME_JS = ['.js', '.ts']
export const EXTNAME_VUE = ['.vue', '.nvue', '.fvue']
export const EXTNAME_VUE_RE = /\.(vue|nvue|fvue)$/
export const H5_API_STYLE_PATH = '@dcloudio/uni-h5/style/api/'
export const H5_FRAMEWORK_STYLE_PATH = '@dcloudio/uni-h5/style/framework/'
......
......@@ -9,6 +9,8 @@ export const jsContext = {
MP_WEIXIN: false,
QUICKAPP_NATIVE: false,
QUICKAPP_WEBVIEW: false,
QUICKAPP_WEBVIEW_UNION: false,
QUICKAPP_WEBVIEW_HUAWEI: false,
MP: false,
APP: false,
APP_PLUS_NVUE: false,
......
......@@ -25,7 +25,6 @@
"localstorage-polyfill": "^1.0.1",
"pako": "^2.0.3",
"safe-area-insets": "^1.4.1",
"vue-router": "^4.0.6",
"xmlhttprequest": "^1.8.0"
},
"peerDependencies": {
......
......@@ -7,6 +7,7 @@ export function createOptimizeDeps(
return {
exclude: [
'vue',
'vuex',
'vue-router',
'@dcloudio/uni-app',
'@dcloudio/uni-components',
......
......@@ -67,26 +67,29 @@ export function uniEasycomPlugin(options: UniPluginFilterOptions): Plugin {
debugEasycom(id)
let i = 0
const importDeclarations: string[] = []
code = code.replace(/_resolveComponent\("(.+?)"\)/g, (str, name) => {
if (name && !name.startsWith('_')) {
if (isBuiltInComponent(name)) {
return addBuiltInImportDeclaration(
importDeclarations,
`__syscom_${i++}`,
name
)
}
const source = matchEasycom(name)
if (source) {
return addImportDeclaration(
importDeclarations,
`__easycom_${i++}`,
source
)
code = code.replace(
/_resolveComponent\("(.+?)"(, true)?\)/g,
(str, name) => {
if (name && !name.startsWith('_')) {
if (isBuiltInComponent(name)) {
return addBuiltInImportDeclaration(
importDeclarations,
`__syscom_${i++}`,
name
)
}
const source = matchEasycom(name)
if (source) {
return addImportDeclaration(
importDeclarations,
`__easycom_${i++}`,
source
)
}
}
return str
}
return str
})
)
if (importDeclarations.length) {
code = importDeclarations.join('') + code
}
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册