chore(docs): copy vue flow files on dev build
This commit is contained in:
@@ -2,10 +2,7 @@ import { existsSync, readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import type { Plugin } from 'vite'
|
||||
|
||||
export function copyVueFlowPlugin(): Plugin {
|
||||
return {
|
||||
name: 'copy-vue-flow',
|
||||
generateBundle() {
|
||||
function copyFiles(emit: any) {
|
||||
;[
|
||||
{ path: '../../../node_modules/@vue-flow/core/dist/', pkgName: 'vue-flow-core.mjs' },
|
||||
{
|
||||
@@ -34,7 +31,7 @@ export function copyVueFlowPlugin(): Plugin {
|
||||
throw new Error(`${pkgName} not built. ` + `Run "pnpm -w build" first.`)
|
||||
}
|
||||
|
||||
;(this as any).emitFile({
|
||||
emit({
|
||||
type: 'asset',
|
||||
fileName: pkgName,
|
||||
source: readFileSync(filePath, 'utf-8'),
|
||||
@@ -44,6 +41,18 @@ export function copyVueFlowPlugin(): Plugin {
|
||||
})
|
||||
|
||||
console.log('Copied vue-flow files')
|
||||
}
|
||||
export function copyVueFlowPlugin(): Plugin {
|
||||
return {
|
||||
name: 'copy-vue-flow',
|
||||
buildStart() {
|
||||
copyFiles((file: any) => this.emitFile(file))
|
||||
},
|
||||
watchChange() {
|
||||
copyFiles((file: any) => this.emitFile(file))
|
||||
},
|
||||
generateBundle() {
|
||||
copyFiles((file: any) => this.emitFile(file))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user