29 lines
646 B
TypeScript
29 lines
646 B
TypeScript
import { defineConfig } from 'vite'
|
|
import preact from '@preact/preset-vite'
|
|
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
|
|
import path from 'path'
|
|
|
|
export default defineConfig({
|
|
plugins: [preact()],
|
|
assetsInclude: ['**/*.md'],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
esbuildOptions: {
|
|
// Node.js global to browser globalThis
|
|
define: {
|
|
global: 'globalThis',
|
|
},
|
|
// Enable esbuild polyfill plugins
|
|
plugins: [
|
|
NodeGlobalsPolyfillPlugin({
|
|
buffer: true,
|
|
}),
|
|
],
|
|
},
|
|
},
|
|
})
|