feat(build): umd 构建,支持 <script> 直接引入使用
This commit is contained in:
40
script/build.umd.ts
Normal file
40
script/build.umd.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { UserConfigExport } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { resolve } from 'path'
|
||||
|
||||
export default (): UserConfigExport => {
|
||||
return {
|
||||
publicDir: false,
|
||||
resolve: {
|
||||
alias: [
|
||||
{
|
||||
find: '@',
|
||||
replacement: resolve(process.cwd(), './')
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
],
|
||||
build: {
|
||||
cssCodeSplit: false,
|
||||
outDir: 'umd',
|
||||
emptyOutDir: true,
|
||||
lib: {
|
||||
entry: resolve(process.cwd(), './src/index.ts'),
|
||||
name: 'LayuiVue',
|
||||
formats: ['umd'],
|
||||
fileName: (name) => `index.js`
|
||||
},
|
||||
rollupOptions: {
|
||||
output: {
|
||||
globals: {
|
||||
vue: 'Vue'
|
||||
},
|
||||
assetFileNames: 'index.css',
|
||||
},
|
||||
external: ['vue', 'vue-router']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user