-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
33 lines (32 loc) · 963 Bytes
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { resolve } from 'path'
import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
export default defineConfig({
build: {
rollupOptions: {
input: {
main: resolve(__dirname, './index.html'),
},
},
},
plugins: [
nodePolyfills({
overrides: {
fs: resolve(__dirname, './polyfills/fs'),
stream: resolve(__dirname, './polyfills/stream'),
},
// Not sure what was going on here, but because readable-stream imports
// this as `require('process/')`, this was not being transformed correctly
// between ESM and CJS. Excluding it from this plugin and aliasing it
// below seems to work somehow.
exclude: ['process'],
}),
],
resolve: {
alias: {
// Note: This doesn't actually seem to produce correct crc32 results.
'@node-rs/crc32': resolve(__dirname, './src/crc32.js'),
process: 'process',
},
},
})