formaat-design / reshaped

Community repository for storing examples, reporting issues and tracking roadmap
https://reshaped.so
97 stars 3 forks source link

Remix Vite Setup Issues #224

Closed muco-rolle closed 3 months ago

muco-rolle commented 3 months ago

Describe the bug I installed Reshaped in a new Remix Vite app, following the integration guide that is featured on the website. If you run the server you encounter with an Unexpected token 'export' message on the screen.

To Reproduce Create an isolated reproduction on the CodeSandox: https://stackblitz.com/edit/remix-run-remix-2cgh4v?file=postcss.config.js,app%2Froot.tsx,app%2Froutes%2F_index.tsx

Expected behavior A clear and concise description of what you expected to happen.

Screenshots Screenshot from 2024-03-07 10-45-37

Environment (please complete the following information):

blvdmitry commented 3 months ago

Hey, seems like the docs were missing one step which we actually have in the example in the repo. You need to add serverDependenciesToBundle: ["reshaped"] to your remix.config.js. Just tried it with the latest remix version. Going to add it to the website too

corydeppen commented 3 months ago

According to the Remix docs on remix.config.js...

remix.config.js is only relevant when using the Classic Remix Compiler. When using Remix Vite, this file should not be present in your project. Instead, Remix configuration should be provided to the Remix plugin in your Vite config.

For Remix Vite projects, I'm wondering if using the ssr.noExternal option in the Vite config that's mentioned in the docs may be a possible solution.

blvdmitry commented 3 months ago

Totally, we've discussed this on X too with @muco-rolle and my latest (not yet pushed) example handles everything right besides a single compound component import issue that comes from the Next.js RSC requirements so got to find the right balance there before shipping this

blvdmitry commented 3 months ago

FormControl error should be gone now in 2.10.4 (more context and what was happening: https://x.com/markdalgleish/status/1770557434584785213?s=20)

blvdmitry commented 3 months ago

Updated the Remix example with Vite setup too https://github.com/formaat-design/reshaped/tree/main/examples/starter-remix