Kurate/packages/ui/vite.config.ts
2023-02-16 23:13:40 +01:00

30 lines
680 B
TypeScript

import { sveltekit } from '@sveltejs/kit/vite'
import type { UserConfig } from 'vite'
import inject from '@rollup/plugin-inject'
import stdLibBrowser from 'node-stdlib-browser'
const config: UserConfig = {
plugins: [
sveltekit(),
{
...inject({
global: ['node-stdlib-browser/helpers/esbuild/shim', 'global'],
process: ['node-stdlib-browser/helpers/esbuild/shim', 'process'],
Buffer: ['node-stdlib-browser/helpers/esbuild/shim', 'Buffer'],
}),
enforce: 'post',
},
],
test: {
include: ['tests/unit/**/*.{test,spec}.{js,ts}'],
},
resolve: {
alias: stdLibBrowser,
},
optimizeDeps: {
include: ['buffer', 'process'],
},
}
export default config