mirror of
https://github.com/dergigi/boris.git
synced 2026-02-01 05:04:29 +01:00
build(vite): alias async-event-store to shim to avoid Vercel resolution error
- Add alias for applesauce-core/dist/event-store/async-event-store.js - Provide minimal shim module so bundler resolves cleanly - Use node:path and import.meta.url to build absolute path - Keep linter strict (added ts-expect-error for node path types)
This commit is contained in:
@@ -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'],
|
||||
|
||||
Reference in New Issue
Block a user