Issues getting @adobe/react-spectrum to work #791
Unanswered
stuartlynn
asked this question in
Help & Questions
Replies: 2 comments 4 replies
-
Have you tried the solution mentioned at https://vite-plugin-ssr.com/common-issues#libraries-containing-invalid-esm? The workaround also works for libraries containing CSS imports. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ack sorry I didn't realize that also applied to css imports. That seems to have resolved the css error but now it's complaining about importing one of the sub dependencies which appears to be an mjs module. Will fiddle around with the config some more and see if I can't get that to resolve too. Thanks for the fast response 5:22:04 PM [vite] Error when evaluating SSR module /node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@adobe/react-spectrum-ui/dist/CornerTriangle.js:
5:22:04 PM [vite] Error when evaluating SSR module /node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]/node_modules/@spectrum-icons/ui/CornerTriangle.module.mjs:
5:22:04 PM [vite] Error when evaluating SSR module /node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]/node_modules/@react-spectrum/button/dist/import.mjs:
5:22:04 PM [vite] Error when evaluating SSR module /node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]/node_modules/@react-spectrum/actiongroup/dist/import.mjs:
5:22:04 PM [vite] Error when evaluating SSR module /node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@adobe/react-spectrum/dist/import.mjs:
5:22:04 PM [vite] Error when evaluating SSR module /pages/index/index.page.tsx:
ReferenceError: exports is not defined
at /node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@adobe/react-spectrum-ui/dist/CornerTriangle.js:12:23
at instantiateModule (file:///home/stuart/tmp/vite-ssr-example/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-79892de8.js:53996:15)
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey all. First of all, I want to say that after bashing my head against the inflexibility of next.js for about a year I am super excited about the more un-opinonated approach that vite-plugin-ssr is taking. It's really refreshing.
I am having an issue porting a project from next.js to vite-plugin-ssr which extensively uses @adobe/react-spectrum for the UI. I am struggling to get even a simple @adobe/react-spectrum project to work. Using the vite-plugin-ssr boiler plate I put together this super simple example which simple sets up the spectrum SSR provider and tries to render a basic component
index.page.tsx
When I try to load the home page though, it gives me the following error:
It seems like vite is not processing the css that is imported by @adobe/react-spectrum and it's getting passed to node which then, understandably, cant process it.
Is there something I am missing in the configuration to get this to work? With next.js, @adobe/react-spectrum recommends transpiling the library in next.config.js . Does vite-plugin-ssr need something similar? From reading the docs I got the impression that it should handle css like this automatically.
Any help appreciated and example repo with the issue can be found here : https://github.com/stuartlynn/vite-ssr-spectrum-bug/tree/main
Beta Was this translation helpful? Give feedback.
All reactions