-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
4,208 additions
and
4,700 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,56 @@ | ||
import { resolve } from 'node:path' | ||
import { defineConfig } from 'vite' | ||
import Vue from '@vitejs/plugin-vue' | ||
import dts from 'vite-plugin-dts' | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
base: '/play/', | ||
plugins: [ | ||
Vue(), | ||
dts({ | ||
entryRoot: './', | ||
outDir: ['dist/es', 'dist/lib'], | ||
// 指定使用的tsconfig.json为我们整个项目根目录下,如果不配置,你也可以在components下新建tsconfig.json | ||
tsconfigPath: '../../tsconfig.json', | ||
}), | ||
], | ||
build: { | ||
minify: false, | ||
emptyOutDir: true, | ||
lib: { | ||
entry: resolve(__dirname, './index.ts'), | ||
name: 'index', | ||
fileName: 'index', | ||
}, | ||
rollupOptions: { | ||
// 确保外部化处理那些你不想打包进库的依赖 | ||
external: ['vue'], | ||
output: { | ||
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量 | ||
globals: { | ||
vue: 'Vue', | ||
output: [ | ||
{ | ||
// 打包格式 | ||
format: 'es', | ||
// 打包后文件名 | ||
entryFileNames: '[name].mjs', | ||
// 让打包目录和我们目录对应 | ||
preserveModules: true, | ||
exports: 'named', | ||
// 打包结果目录 | ||
dir: 'dist/es', | ||
// 打包当前目录 | ||
preserveModulesRoot: '', | ||
}, | ||
}, | ||
{ | ||
// 打包格式 | ||
format: 'cjs', | ||
// 打包后文件名 | ||
entryFileNames: '[name].js', | ||
// 让打包目录和我们目录对应 | ||
preserveModules: true, | ||
exports: 'named', | ||
// 打包结果目录 | ||
dir: 'dist/lib', | ||
// 打包当前目录 | ||
preserveModulesRoot: '', | ||
}, | ||
], | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.