fix(build): stub import-in-the-middle for bun compatibility
This commit is contained in:
2
bun.lock
2
bun.lock
@@ -5,6 +5,7 @@
|
||||
"": {
|
||||
"name": "esports",
|
||||
"dependencies": {
|
||||
"@sentry/sveltekit": "^10.43.0",
|
||||
"bancho.js": "^0.12.3",
|
||||
"discord.js": "^14.25.1",
|
||||
"pino": "^10.3.1",
|
||||
@@ -15,7 +16,6 @@
|
||||
"@eslint/compat": "^2.0.2",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@playwright/test": "^1.58.1",
|
||||
"@sentry/sveltekit": "^10.43.0",
|
||||
"@sveltejs/adapter-node": "^5.5.4",
|
||||
"@sveltejs/kit": "^2.55.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
"@eslint/compat": "^2.0.2",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@playwright/test": "^1.58.1",
|
||||
"@sentry/sveltekit": "^10.43.0",
|
||||
"@sveltejs/adapter-node": "^5.5.4",
|
||||
"@sveltejs/kit": "^2.55.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
||||
@@ -71,7 +72,6 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@sentry/sveltekit": "^10.43.0",
|
||||
"bancho.js": "^0.12.3",
|
||||
"discord.js": "^14.25.1",
|
||||
"pino": "^10.3.1"
|
||||
|
||||
@@ -1,12 +1,32 @@
|
||||
import devtoolsJson from 'vite-plugin-devtools-json';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import { defineConfig, type Plugin } from 'vitest/config';
|
||||
import { playwright } from '@vitest/browser-playwright';
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import { sentrySvelteKit } from '@sentry/sveltekit';
|
||||
|
||||
// Stub import-in-the-middle — its ESM loader hooks are Node-only and crash Bun.
|
||||
// Sentry's manual error tracking (sentryHandle, captureException) still works;
|
||||
// only automatic OpenTelemetry instrumentation is disabled.
|
||||
function stubIITM(): Plugin {
|
||||
return {
|
||||
name: 'stub-import-in-the-middle',
|
||||
resolveId(id) {
|
||||
if (id === 'import-in-the-middle' || id.startsWith('import-in-the-middle/')) {
|
||||
return '\0iitm-stub';
|
||||
}
|
||||
},
|
||||
load(id) {
|
||||
if (id === '\0iitm-stub') {
|
||||
return 'export class Hook { constructor() {} enable() {} disable() {} unhook() {} }';
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
stubIITM(),
|
||||
tailwindcss(),
|
||||
sentrySvelteKit({
|
||||
org: 'vash-software-vr',
|
||||
@@ -17,11 +37,11 @@ export default defineConfig({
|
||||
devtoolsJson()
|
||||
],
|
||||
ssr: {
|
||||
external: ['bun', 'pino', 'pino-pretty', '@sentry/sveltekit', '@sentry/node']
|
||||
external: ['bun', 'pino', 'pino-pretty']
|
||||
},
|
||||
build: {
|
||||
rollupOptions: {
|
||||
external: ['bun', 'pino', 'pino-pretty', '@sentry/sveltekit', '@sentry/node']
|
||||
external: ['bun', 'pino', 'pino-pretty']
|
||||
},
|
||||
reportCompressedSize: false
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user