Failed to import - @solidjs/router
Failing module
- GitHub: https://github.com/solidjs/solid-router/
- npm: https://www.npmjs.com/package/@solidjs/router
import { Router } from 'https://esm.sh/@solidjs/router'
Error message
After running deno run I got this:
Uncaught SyntaxError: The requested module /v106/[email protected]/deno/web.js does not provide an export named 'template'.
Additional info
- esm.sh version:
- Deno version: 1.29.1
This is occurring because the project uses Conditional exports to export server code versus client-code. https://github.com/solidjs/solid-router/blob/main/package.json#L21-L26
This could be fixed by giving us an option to provide conditionals. https://esbuild.github.io/api/#conditions
currently we don't use conditionals of esbuild, since solid-js/web server.js doesn't export template, you can set the target to es2020 to force using web.js instead of `server.js of solid-js/web if you don't use the SSR.
~~oh i think this is a solid-js bug~~
Isn't that running the client version of solid-js/web? So it's looking for browser stuff in Deno?
The issue afaik is that the router defaults to client code. So if you pass it the client version of solid-js/web then the router will work but solid-js/web will not.
for deno target, the server will build the module with the ./web/dist/server.js to support SSR, check https://github.com/solidjs/solid/blob/695d99b6fbc1f55c91aed0600b0c1f13e4ee426c/packages/solid/package.json#LL180C16-L180C16