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

fix(nvue): copy assets

上级 3d2b4ba2
......@@ -28,6 +28,7 @@ export function uniEsbuildPlugin({
}): Plugin {
let resolvedConfig: ResolvedConfig
let buildOptions: BuildOptions
const nvueOutputDir = nvueOutDir()
const outputDir = process.env.UNI_OUTPUT_DIR
let isFirst = true
return {
......@@ -50,6 +51,7 @@ export function uniEsbuildPlugin({
},
async writeBundle(_, bundle) {
const entryPoints: string[] = []
const assets: string[] = []
Object.keys(bundle).forEach((name) => {
const chunk = bundle[name]
if (
......@@ -58,8 +60,19 @@ export function uniEsbuildPlugin({
chunk.facadeModuleId.endsWith('.nvue')
) {
entryPoints.push(name)
} else if (chunk.type === 'asset') {
assets.push(name)
}
})
assets.forEach((name) => {
fs.copySync(
path.resolve(nvueOutputDir, name),
path.resolve(outputDir, name),
{ overwrite: false }
)
})
if (!entryPoints.length) {
return
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册