Skip to content

Commit

Permalink
chore: fix for vercel
Browse files Browse the repository at this point in the history
  • Loading branch information
haoziqaq committed Mar 15, 2023
1 parent 66c95df commit 40fcc3b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/varlet-ui-playground/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
import fs from 'fs'
import components from 'unplugin-vue-components/vite'
import autoImport from 'unplugin-auto-import/vite'
import { resolve } from 'path'
import { VarletUIResolver } from 'unplugin-vue-components/resolvers'
import { defineConfig, Plugin } from 'vite'

const cwd = process.cwd()

function copyVarletDependencies(): Plugin {
return {
name: 'copy-varlet-dependencies',

buildStart() {
fs.copyFileSync('../varlet-ui/es/varlet.esm.js', './public/varlet.esm.js')
fs.copyFileSync('../varlet-touch-emulator/index.js', './public/varlet-touch-emulator.js')
fs.copyFileSync('../varlet-ui/es/style.css', './public/varlet.css')
fs.writeFileSync('./public/varlet-area.js', `export default ${fs.readFileSync('../varlet-ui/json/area.json')}`)
fs.copyFileSync(resolve(cwd, '../varlet-ui/es/varlet.esm.js'), resolve(cwd, 'public/varlet.esm.js'))
fs.copyFileSync(
resolve(cwd, '../varlet-touch-emulator/index.js'),
resolve(cwd, 'public/varlet-touch-emulator.js')
)
fs.copyFileSync(resolve(cwd, '../varlet-ui/es/style.css'), resolve(cwd, 'public/varlet.css'))
fs.writeFileSync(
resolve(cwd, 'public/varlet-area.js'),
`export default ${fs.readFileSync(resolve(cwd, '../varlet-ui/json/area.json'))}`
)
},
}
}
Expand Down

0 comments on commit 40fcc3b

Please sign in to comment.