forked from broxus/everscale-web-tools
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
53 lines (49 loc) · 1.27 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { defineConfig, Plugin, ViteDevServer } from 'vite';
import vue from '@vitejs/plugin-vue';
import checker from 'vite-plugin-checker';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import * as path from 'path';
import fs from 'fs';
export const disasmVite = (): Plugin => {
return {
name: 'disasm-wasm-vite',
configureServer(server: ViteDevServer) {
server.middlewares.use((req, res, next) => {
if (req?.url?.endsWith('tycho_disasm_bg.wasm')) {
const wasmPath = path.resolve(__dirname, './node_modules/@tychosdk/disasm/dist/wasm/tycho_disasm_bg.wasm');
const wasmFile = fs.readFileSync(wasmPath);
res.setHeader('Content-Type', 'application/wasm');
res.end(wasmFile);
return;
}
next();
});
}
};
};
export default defineConfig({
plugins: [
vue(),
checker({
typescript: true
}),
nodePolyfills(),
disasmVite()
],
publicDir: path.resolve(__dirname, 'public'),
resolve: {
alias: {
'@core': path.resolve(__dirname, 'core/pkg'),
'@debugger': path.resolve(__dirname, 'debugger/pkg')
}
},
envPrefix: 'BYTIE_',
build: {
target: 'es2020'
},
optimizeDeps: {
esbuildOptions: {
target: 'es2020'
}
}
});