Skip to content

Commit

Permalink
fix: unocss ready
Browse files Browse the repository at this point in the history
  • Loading branch information
mater1996 committed Dec 10, 2024
1 parent 792cde2 commit cc0cbf8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/unocss-plugin/lib/rn-plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ function WebpackPlugin (configOrPath, defaults) {
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const mpx = compilation.__mpx__
const { mode, srcMode } = mpx
ctx.ready.then(() => mpx.unoCtx = ctx.uno)
compilation.hooks.optimizeAssets.tapPromise(PLUGIN_NAME, async () => {
await ctx.ready
// 清空transformCache避免watch修改不生效
Expand Down Expand Up @@ -80,10 +79,6 @@ function WebpackPlugin (configOrPath, defaults) {
if (file === '*') { return }
let code = compilation.assets[file].source().toString()
let replaced = false

console.log(2222, classMap);


code = code
.replace('__unocssMap__', () => {
replaced = true
Expand All @@ -102,6 +97,11 @@ function WebpackPlugin (configOrPath, defaults) {
}
})
})

compiler.hooks.make.tapPromise(PLUGIN_NAME, (compilation) => {
const mpx = compilation.__mpx__
return ctx.ready.then(() => mpx.unoCtx = ctx.uno)
})
}
}
}
Expand Down

0 comments on commit cc0cbf8

Please sign in to comment.