Anyone else having trouble building a production build with Remix 2.9.1? Not using single fetch, but I get this:
$ NODE_OPTIONS='--import tsx' yarn remix vite:build
...build...
$ yarn remix-serve build/server/index.js
/src/node_modules/@remix-run/serve/dist/cli.js:114
nativeFetch: build.future.unstable_singleFetch
^
TypeError: Cannot read properties of undefined (reading 'unstable_singleFetch')
at run (/src/node_modules/@remix-run/serve/dist/cli.js:114:31)
vite.config.ts:
import { vitePlugin as remix } from '@remix-run/dev'
import { installGlobals } from '@remix-run/node'
import react from '@vitejs/plugin-react'
import { remixDevTools } from 'remix-development-tools'
import viteEnvOnly from 'vite-env-only'
import inspectPlugin from 'vite-plugin-inspect'
import topLevelAwait from 'vite-plugin-top-level-await'
import tsconfigPaths from 'vite-tsconfig-paths'
import { inPlaywright, inVitest } from '@myorg/test-utils'
import type { ConfigEnv, UserConfig } from 'vite'
const port = 3000
export default function defineConfig({ command, mode }: ConfigEnv): UserConfig {
installGlobals()
return {
build: {
minify: true,
sourcemap: true,
},
clearScreen: false,
define: {
// https://vitest.dev/guide/in-source#production-build
'import.meta.vitest': 'undefined',
},
server: {
port,
},
ssr: {
noExternal: [/react-use/],
},
plugins: [
viteEnvOnly(),
topLevelAwait(),
!inVitest() && !inPlaywright() && inspectPlugin(),
tsconfigPaths(),
!inVitest() &&
!inPlaywright() &&
remixDevTools({
client: {
defaultOpen: false,
panelLocation: 'bottom',
position: 'bottom-left',
requireUrlFlag: true,
urlFlag: 'rdt',
},
includeInProd: false,
}),
!inVitest()
? remix({
appDirectory: 'src',
ignoredRouteFiles: ['**/*.test.{js,jsx,ts,tsx}', '**/*.css'],
serverModuleFormat: 'esm',
})
: react(),
],
}
}