AFFiNE/packages/common/y-indexeddb/vite.config.ts
LongYinan fa8655e43e
style: apply prefer-node-protocol lint rule (#5627)
it makes it perfectly clear that the package is a Node.js builtin module.
2024-01-19 03:47:08 +00:00

36 lines
776 B
TypeScript

import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
export default defineConfig({
build: {
minify: 'esbuild',
sourcemap: true,
lib: {
entry: resolve(__dirname, 'src/index.ts'),
fileName: 'index',
name: 'ToEverythingIndexedDBProvider',
formats: ['es', 'cjs', 'umd'],
},
rollupOptions: {
output: {
globals: {
idb: 'idb',
yjs: 'yjs',
'y-provider': 'yProvider',
},
},
external: ['idb', 'yjs', 'y-provider'],
},
},
plugins: [
dts({
entryRoot: resolve(__dirname, 'src'),
}),
],
});