feat: first add
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
lib: {
|
||||
entry: './index.mjs', // 你的库的入口文件,这里假设是 src/main.mjs
|
||||
name: 'funjia-server', // 库的全局名称,将在浏览器环境中使用
|
||||
formats: ['es'], // 输出的模块格式,这里包含 ES 模块和 UMD 模块
|
||||
// fileName: (format) => `your-library-name.${format}.js` // 输出的文件名,根据不同的格式生成不同的文件名
|
||||
},
|
||||
rollupOptions: {
|
||||
// 确保不包含 Node.js 特定的模块,避免将 Node.js 模块错误地打包到浏览器代码中
|
||||
external: ['fs', 'path','url','node','node-cron','cuid','dayjs','koa','koa-body',
|
||||
'koa-mount','koa-router','koa-static','lodash','lowdb','multer','uuid','yaml','@koa/multer','@types/yaml'],
|
||||
output: {
|
||||
exports: 'named',
|
||||
// 在 Node.js 环境中不需要全局变量,可将此设置为 undefined
|
||||
globals: undefined
|
||||
}
|
||||
},
|
||||
// 构建为 Node.js 库时,将输出目录设置为 lib 而不是 dist,可根据需要修改
|
||||
outDir: 'lib'
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user