Skip to content
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

Doesn't work with swc #72

Closed
t-animal opened this issue Mar 8, 2023 · 10 comments
Closed

Doesn't work with swc #72

t-animal opened this issue Mar 8, 2023 · 10 comments

Comments

@t-animal
Copy link

t-animal commented Mar 8, 2023

When using "@vitejs/plugin-react-swc": "^3.1.0" instead of "@vitejs/plugin-react": "^3.1.0", running the app fails with an exception 2:50:04 PM [vite] Internal server error: Invalid glob import syntax: Expect CallExpression, got BinaryExpression

@oedotme
Copy link
Owner

oedotme commented Mar 8, 2023

I recall that was fixed at #52 by @spa5k, but it seems the related issue at @vitejs/plugin-react-swc was reopened recently. Please follow up at vitejs/vite-plugin-react-swc#53 as it's mostly has to do with @vitejs/plugin-react-swc.

Also here's the related closed issue at generouted #37

@spa5k
Copy link
Contributor

spa5k commented Mar 9, 2023

There seems to be some problems related with jsx tsx stuff and vite isn't compiling them (swc version)

@spa5k
Copy link
Contributor

spa5k commented Mar 12, 2023

@oedotme since vite isnt considering tsx / jsx files, maybe we can do an experimental package if it works after transpiling it to latest JS ESNEXT (through tsup or rollup)

@oedotme
Copy link
Owner

oedotme commented Mar 13, 2023

@spa5k TBH, I'd vote to wait for vite-plugin-react-swc to support jsx/tsx as the current vite-plugin-react

@ghost
Copy link

ghost commented Mar 14, 2023

@oedotme
Am I correct in assuming that this repository does not currently work with Vite3?
If not, you should put a note in the README.

@spa5k
Copy link
Contributor

spa5k commented Mar 15, 2023

It works with latest vite, you need to use react plugin, not the react plugin swc one

@oedotme
Copy link
Owner

oedotme commented Mar 15, 2023

Although it's recommended to use the latest Vite versions, Vite v3 still working fine with generouted and there's no reason for it not to work, the Vite APIs used are the same since v2 if I recall correctly.

This issue is about the new plugin for React with Vite based on swc not working as expected. It should work tho once the swc plugin supports jsx/tsx same as the other official React plugin based on babel and esbuild.

@ArnaudBarre
Copy link

Hi,

So turns out ts + dts file are not working to silence the error. So I think it's better to bundle the lib to avoid this kind of issue.

I still think we should push TS to better support this and I added support for transpiling TS files in node_modules in the SWC plugin (not released yet).

For info I think the modal is not working on the basic demo for react-router.

@oedotme
Copy link
Owner

oedotme commented Mar 29, 2023

Hey everyone, @vitejs/plugin-react-swc should be also compatible now with the latest generouted release at v1.12.0. There are minor import changes needed for the upgrade and its included in the release notes.

I've tested it with the latest version v3.2.0 and it's working 🎉 That made possible by introducing bundling to js step for the published package as @spa5k suggested here.

I'm closing this now, please let me know if you have any issues with the swc plugin.

@oedotme oedotme closed this as completed Mar 29, 2023
@oedotme
Copy link
Owner

oedotme commented Mar 29, 2023

@ArnaudBarre Thanks for mentioning the modals with the basic example, I believe it's working but there's no modals created/available to show 😃

I'm currently working on improving the examples and docs 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants