提交 7471218c 编写于 作者: fxy060608's avatar fxy060608

fix(mp): wxs hmr

上级 612c479e
......@@ -23,8 +23,6 @@ export function uniRenderjsPlugin({ lang }: { lang?: string }): Plugin {
name: 'uni:mp-renderjs',
configResolved(config) {
resolvedConfig = config
},
buildStart() {
filtersCache.set(resolvedConfig, [])
},
transform(code, id) {
......@@ -43,12 +41,19 @@ export function uniRenderjsPlugin({ lang }: { lang?: string }): Plugin {
if (!name) {
this.error(missingModuleName(type, code))
} else {
filtersCache.get(resolvedConfig)!.push({
id,
type,
name,
code,
})
let cache = filtersCache.get(resolvedConfig)
if (cache) {
const index = cache.findIndex((item) => item.id === id)
if (index > -1) {
cache.splice(index, 1)
}
cache.push({
id,
type,
name,
code,
})
}
}
return {
code: genWxsCallMethodsCode(code),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册