-
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
v2_dev build not parsing JSX in javascript #7051
Comments
I'm not sure what happened in your case, but The error you're seeing is because you renamed the files to |
Fair to mark this as not planned, but it is a breaking change from v2_dev: false and differs from remix build which was confusing to me at least. Note that esbuild does support jsx in js: https://esbuild.github.io/content-types/#jsx In my case, I have a pre remix build step for babel to transpile the ts/tsx to support relay macros. Previously babel was leaving the jsx unmodified in the js output as it seems preferable to have remix build do all react specific transforms. The workaround for now was to go ahead and have babel transform that jsx rather than remix. Let me know if jsx in js support is reconsidered for v2_dev. |
I run into the same issue. It's definitely a breaking change not mentioned in the documentation. @brentmjohnson did you find any suitable workaround beside renaming hundreds of files from |
I also wonder why it differs between |
Looks like the reason it differs between I suspect the |
Or might be caused by |
Ok, even simpler. This change in line https://github.com/remix-run/remix/blob/main/packages/remix-dev/compiler/js/plugins/hmr.ts#L142 works for me: --- a/node_modules/@remix-run/dev/dist/compiler/js/plugins/hmr.js
+++ b/node_modules/@remix-run/dev/dist/compiler/js/plugins/hmr.js
@@ -161,7 +161,7 @@ declare global {
sourceCode,
output: {
contents: resultCode,
- loader: args.path.endsWith("x") ? "tsx" : "ts",
+ loader: "tsx",
resolveDir: path__namespace.dirname(args.path)
}
}; |
Fixed by #7112 |
@jaschaio, just for reference and for those using babel for pre-transpile before remix build there were 2 ways to address something like this as a workaround in case something similar comes up:
|
🤖 Hello there, We just published version Thanks! |
What version of Remix are you using?
1.19.1
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
see https://github.com/brentmjohnson/remixQuickStart for reproducible example.
init new project from template
npx create-remix@latest --template https://github.com/remix-run/remix/tree/main/templates/express ./ --no-typescript
notice tsx files are still created instead of js
replace the following files with valid js versions:
npm run build succeeds:
npm run dev fails:
Expected Behavior
remix dev build occurring in v2_dev should succeed like remix production build
Actual Behavior
remix dev build occurring in v2_dev fails
The text was updated successfully, but these errors were encountered: