solidjs / solid-router

A universal router for Solid inspired by Ember and React Router
MIT License
1.13k stars 143 forks source link

Cannot export parts of '@solidjs/router' #286

Closed KevinBLT closed 7 months ago

KevinBLT commented 1 year ago

Describe the bug

Simply when I do:

export { A, Route, Routes, Outlet } from '@solidjs/router';

The application will not build (ssr) and fail with:

file:///node_modules/@solidjs/router/dist/index.js:1
import { isServer, delegateEvents, createComponent as createComponent$1, spread, mergeProps as mergeProps$1, template } from 'solid-js/web';
                                                                                                             ^^^^^^^^
SyntaxError: The requested module 'solid-js/web' does not provide an export named 'template'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:122:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:188:5)

Looks like some of the magic generated code breaks after build.

E.g. @solidjs/meta doesn't have this problem.

Any idea? Or am I missing something?

Your Example Website or App

Code above

Steps to Reproduce the Bug or Issue

Use the code above in I file in a vite ssr build.

Expected behavior

Export these components

Screenshots or Videos

No response

Platform

Additional context

No response

ryansolid commented 12 months ago

This looks like it is pulling in the client version of Solid on the server. For SSR we don't actually ship different versions of the library, because the client build is different too.. Instead we recommend using solid export condition which pulls in the source. Our Vite plugin should be setting that automatically. But that is where I'd start my search.

KevinBLT commented 11 months ago

I might have an idea, what to change maybe. Still I don't understand why it's only the router and none of the other packages? Wouldn't that affect all of them equally?

ryansolid commented 7 months ago

Closing as stale. I'd need a concrete example to look at this more.

empro-narendervaddepelly commented 7 months ago

Why some components weren't exposed or do they replaced?

Module '"@solidjs/router"' has no exported member 'Outlet' Module '"@solidjs/router"' has no exported member 'useRoutes'

^0.10.9

md-owes commented 1 month ago

@ryansolid, i upgraded all frontend libraries in my application and suddenly there are issues related to Outlet and RouteDataFuncArgs. I have downgraded @solidjs/router to 0.9.1 as there is no clear documentation with examples to execute this migration. Would really appreciate if there is a clear migration path for breaking changes.