Skip to content

Commit b50353a

Browse files
committed
workflow(sfc-playground): copy server-renderer browser build
1 parent ec2856c commit b50353a

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

packages/sfc-playground/vite.config.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,24 @@ function copyVuePlugin(): Plugin {
2121
return {
2222
name: 'copy-vue',
2323
generateBundle() {
24-
const filePath = path.resolve(
25-
__dirname,
26-
'../vue/dist/vue.runtime.esm-browser.js'
27-
)
28-
if (!fs.existsSync(filePath)) {
29-
throw new Error(
30-
`vue.runtime.esm-browser.js not built. ` +
31-
`Run "nr build vue -f esm-browser" first.`
32-
)
24+
const copyFile = (file: string) => {
25+
const filePath = path.resolve(__dirname, file)
26+
const basename = path.basename(file)
27+
if (!fs.existsSync(filePath)) {
28+
throw new Error(
29+
`${basename} not built. ` +
30+
`Run "nr build vue -f esm-browser" first.`
31+
)
32+
}
33+
this.emitFile({
34+
type: 'asset',
35+
fileName: basename,
36+
source: fs.readFileSync(filePath, 'utf-8')
37+
})
3338
}
34-
this.emitFile({
35-
type: 'asset',
36-
fileName: 'vue.runtime.esm-browser.js',
37-
source: fs.readFileSync(filePath, 'utf-8')
38-
})
39+
40+
copyFile(`../vue/dist/vue.runtime.esm-browser.js`)
41+
copyFile(`../server-renderer/dist/server-renderer.esm-browser.js`)
3942
}
4043
}
4144
}

0 commit comments

Comments
 (0)