diff --git a/vite.config.ts b/vite.config.ts index d5eeac76..bd9fb103 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,8 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-expect-error Node built-in types may be missing in editor, available at build time +import path from 'node:path' export default defineConfig({ plugins: [react()], @@ -10,7 +13,12 @@ export default defineConfig({ extensions: ['.js', '.ts', '.tsx', '.json'], conditions: ['import', 'module', 'browser', 'default'], preserveSymlinks: false, - mainFields: ['module', 'jsnext:main', 'jsnext', 'main'] + mainFields: ['module', 'jsnext:main', 'jsnext', 'main'], + alias: { + // applesauce-core publishes async-event-store.js in some environments, but exports map can block deep resolution on Vercel + // We don't use the async store; stub it to avoid bundler trying to resolve it + 'applesauce-core/dist/event-store/async-event-store.js': path.resolve(new URL('./src/shims/applesauce/async-event-store.js', import.meta.url).pathname) + } }, optimizeDeps: { include: ['applesauce-core', 'applesauce-factory', 'applesauce-relay', 'applesauce-react'],