Hello everyone,
I've migrated our ~7 year old react app to remix. The current production version uses the express template with non-vite remix v2.7.0.
I'm now trying to get the app migrated to vite. I followed the instructions in https://remix.run/docs/en/main/guides/vite#migrating. After several attempts I thought I finally had it working using vite-plugin-cjs-interop (edit: I initially wrongly said vite-tsconfig-paths). That is, until I tried to deploy to our staging environment and it failed.
This app uses a very old version of redux-saga v0.16.2 (yes, I know I'll have to fix/remove this 😅 )
The dev server (i.e. yarn dev) is working but when running with the prod build (yarn build; yarn start) it fails with:
$ cross-env NODE_ENV=production node ./server.js
node:internal/modules/run_main:129
triggerUncaughtException(
^
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/Users/username/poc/remix/remix-vite-express2/node_modules/redux-saga/effects' is not supported resolving ES modules imported from /Users/username/poc/remix/remix-vite-express2/build/server/index.js
Did you mean to import "redux-saga/lib/effects.js"?
at finalizeResolution (node:internal/modules/esm/resolve:259:11)
...
code: 'ERR_UNSUPPORTED_DIR_IMPORT',
url: 'file:///Users/username/poc/remix/remix-vite-express2/node_modules/redux-saga/effects'
}
Node.js v20.14.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
You can reproduce this by running:
npx create-remix@latest --template remix-run/remix/templates/express
yarn add [email protected]
Then update app/routes/_index.tsx to import the something from redux-saga/effects and reference it
import type { MetaFunction } from "@remix-run/node";
+import { takeLatest } from "redux-saga/effects";
...
export default function Index() {
+ console.log(takeLatest);
return (
....
Anyone have any pointers?