-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(remix-dev/vite): remove redundant jsx
and typescript
babel plugins
#7998
refactor(remix-dev/vite): remove redundant jsx
and typescript
babel plugins
#7998
Conversation
|
jsx
and typescript
babel plugins + remove remix-react-refresh-babel
plugin from child vite compiler
@@ -928,7 +929,6 @@ export const remixVitePlugin: RemixVitePlugin = (options = {}) => { | |||
parserOpts: { | |||
sourceType: "module", | |||
allowAwaitOutsideFunction: true, | |||
plugins: ["jsx", "typescript"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still want this change. Can we reopen this PR and scope it down to just this one liner?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for re-opening! I updated a PR to include only this change.
Btw, recently macos/webkit CI is often failing with vite-dotenv-test.ts
but I'm not sure if it's related to my PR. Is this something I should worry about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hi-ogawa I'm looking into that test failure now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR got the test passing: #8177. I've just merged dev into your PR.
jsx
and typescript
babel plugins + remove remix-react-refresh-babel
plugin from child vite compilerjsx
and typescript
babel plugins
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
While investigating mdx hmr in #7954, I noticed that
"remix-react-refresh-babel"
plugin'stransform
is receiving already transpiled plain js file, so I think we don't need to addplugins: ["jsx", "typescript"]
for bebel transform.One thing to note is that this is a different from
@vitejs/plugin-react
, which usesenforce: "pre"
. In their case, they are intercepting before vite's internal transform, so jsx/typescript handling is required:https://github.com/vitejs/vite-plugin-react/blob/0cd00a5bf59fe1b326c667efb9c340732c6b0630/packages/plugin-react/src/index.ts#L119-L120
Assuming this first idea is valid, I think remix can then remove
remix-react-refresh-babel
plugin from child vite compiler since the purpose of child compiler is currently only for extracting exports of route file bygetRouteModuleExports
and injecting HMR-related code is not necessary as long as code is transformed to plain js.This could help perf by reducing unnecessary babel transform (though it might not be a significant gain).
Testing Strategy
I think existing tests should be enough to verify the correctness of this idea.