You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since recently (vitejs/vite#5370), Vite got the ability to directly import ts files into config without transpiling by running vite like this vite --configLoader=runner. In react router CLI, this capability seem to be non-existent.
This feature is super useful in the monorepo context, because it lets you save some building time on transpiling the custom plugins (not to mention, the convenience).
The only difference is that Vite app's build works fine, and React Router's doesn't:
> react-router-app@ build /rr-ts-import/apps/react-router-app
> react-router build
failed to load config from /rr-ts-import/apps/react-router-app/vite.config.ts
TypeError: Unknown file extension ".ts" for /rr-ts-import/packages/testPlugin/testPlugin.ts
Steps to install the test repo
# Install repo
clone https://github.com/neochief/rr-ts-import.git rr-ts-import
cd rr-ts-import
pnpm i
# Run the build in the Vite app (succeeds)
pnpm --filter=vite-app run build
# Run the build in the React Router app (fails)
pnpm --filter=react-router-app run build
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Since recently (vitejs/vite#5370), Vite got the ability to directly import ts files into config without transpiling by running vite like this
vite --configLoader=runner
. In react router CLI, this capability seem to be non-existent.This feature is super useful in the monorepo context, because it lets you save some building time on transpiling the custom plugins (not to mention, the convenience).
I've created a PNPM monorepo to show case this use case: https://github.com/neochief/rr-ts-import
This repo has a pure-TS vite plugin that is connected to a regular Vite app and React Router app in exact the same way.
The only difference is that Vite app's build works fine, and React Router's doesn't:
Steps to install the test repo
Beta Was this translation helpful? Give feedback.
All reactions