-
Notifications
You must be signed in to change notification settings - Fork 375
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
Missing imports when using NodeNext
moduleResolution
#657
Comments
How peculiar. The exports are there in the TS code. They just come in from a different source than the others. Very strange. |
Very strange indeed. solid-start/packages/start/index.tsx Line 29 in eaebb34
I updated the line above to include the file extension, and it seems to fix the typing issue. i.e. export * from "./router.jsx"; I added it because Typescript was emitting the following error,
|
I see. Its interesting that some of the relative local paths work without the extension. Maybe it is related to it being an |
Further investigation seems to indicate that See discussion below, Semi related blog post, Working examples in the wild, |
Indeed I just ran into this on a separate project that uses |
I think there are two options to add support for I'm using A partial patch diff --git a/entry-server/index.ts b/entry-server/index.ts
index 0f964ff2aff7c86693ac4a2af1f0d3633841a625..4877c4cd885dc8485b4f21d9b7a3fdc3b7842d68 100644
--- a/entry-server/index.ts
+++ b/entry-server/index.ts
@@ -1,4 +1,4 @@
-export * from "./render";
+export * from "./render.js";
// server-side only exports
-export { composeMiddleware, createHandler, default as StartServer } from "./StartServer";
-export type { Middleware, MiddlewareFn, MiddlewareInput } from "./StartServer";
+export { composeMiddleware, createHandler, default as StartServer } from "./StartServer.jsx";
+export type { Middleware, MiddlewareFn, MiddlewareInput } from "./StartServer.jsx";
diff --git a/index.tsx b/index.tsx
index 74f088b550d05a49f1dcd83cf13bf4f9c20e65c6..0794b203d35954cb5ac5da679e1d1b655658b8f4 100644
--- a/index.tsx
+++ b/index.tsx
@@ -13,7 +13,7 @@ export {
type RouteDataFunc,
type RouteDataFuncArgs as RouteDataArgs
} from "@solidjs/router";
-export type { APIEvent as APIEvent } from "./api";
+export type { APIEvent as APIEvent } from "./api/index.js";
export {
createRouteAction,
createRouteData,
@@ -21,15 +21,15 @@ export {
FormError,
refetchRouteData,
ServerError
-} from "./data";
-export type { FormAction, FormMethod, FormProps, SubmitOptions } from "./data";
-export { default, ErrorBoundary, ErrorMessage } from "./error-boundary";
-export { clientOnly as unstable_clientOnly, island as unstable_island } from "./islands";
-export { Body, Head, Html, Scripts } from "./root";
-export * from "./router";
-export * from "./server/responses";
-export { ServerContext, useRequest as useServerContext } from "./server/ServerContext";
-export type { FetchEvent, PageEvent, ServerFunctionEvent } from "./server/types";
+} from "./data/index.js";
+export type { FormAction, FormMethod, FormProps, SubmitOptions } from "./data/index.js";
+export { default, ErrorBoundary, ErrorMessage } from "./error-boundary/index.js";
+export { clientOnly as unstable_clientOnly, island as unstable_island } from "./islands/index.js";
+export { Body, Head, Html, Scripts } from "./root/index.js";
+export * from "./router.jsx";
+export * from "./server/responses.js";
+export { ServerContext, useRequest as useServerContext } from "./server/ServerContext.jsx";
+export type { FetchEvent, PageEvent, ServerFunctionEvent } from "./server/types.jsx";
export {
createCookie,
createCookieSessionStorage,
@@ -41,7 +41,7 @@ export {
type CookieSerializeOptions,
type SessionIdStorageStrategy,
type SessionStorage
-} from "./session";
+} from "./session/index.js";
import { JSX } from "solid-js";
-import "./types";
+import "./types.js";
export declare function FileRoutes(): JSX.Element;
diff --git a/server/index.ts b/server/index.ts
index e3a17c6cbd5577bb7f1e2b92d2a9c6d1f51d6c2e..262670c9f5b68e5e955cdba6d27a84c39039c150 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -1,5 +1,5 @@
// This file only exists to make the TypeScript tsconfig setting `"moduleResolution": "node"` work.
// See ./server.ts for the server entrypoint and ./browser.ts for the browser entrypoint
-import server$ from "./server";
+import server$ from "./server.js";
export default server$;
-export * from "./server";
+export * from "./server.js";
diff --git a/server/server.ts b/server/server.ts
index 832b5cb0c8319efda5b9941269b0613cca48d226..592eca1b6aee5647eb3ee370d92a514d910da8be 100644
--- a/server/server.ts
+++ b/server/server.ts
@@ -1,5 +1,5 @@
-import { server$ } from "./server-functions/server";
+import { server$ } from "./server-functions/server.js";
export default server$;
-export * from "./shared";
+export * from "./shared.js";
diff --git a/server/shared.ts b/server/shared.ts
index 79bf4402dd2048f4f7fb703e9502a9a8917814f3..df2ce46b132d309369c7088fe4ca30c82727441b 100644
--- a/server/shared.ts
+++ b/server/shared.ts
@@ -1,7 +1,7 @@
-export { HttpHeader } from "./components/HttpHeader";
-export { HttpStatusCode } from "./components/HttpStatusCode";
-export { createServerAction$, createServerData$, createServerMultiAction$, ServerError } from "./data";
-export * from "./responses";
-export * from "./ServerContext";
-export * from "./types";
+export { HttpHeader } from "./components/HttpHeader.jsx";
+export { HttpStatusCode } from "./components/HttpStatusCode.jsx";
+export { createServerAction$, createServerData$, createServerMultiAction$, ServerError } from "./data.js";
+export * from "./responses.js";
+export * from "./ServerContext.jsx";
+export * from "./types.jsx";
diff --git a/virtual/entry-server.tsx b/virtual/entry-server.tsx
index 4e4a3cefb478c59568070fc89dae6489d9dc2f55..0a2159291d73efeb48b4e5f1406f8853bbee16b5 100644
--- a/virtual/entry-server.tsx
+++ b/virtual/entry-server.tsx
@@ -1,3 +1,3 @@
-import { createHandler, renderAsync, StartServer } from "../entry-server";
+import { createHandler, renderAsync, StartServer } from "../entry-server/index.js";
export default createHandler(renderAsync(event => <StartServer event={event} />)); Update: I just checked that applying this patch to a project which uses |
@peterhirn does |
In setting up for SolidStarts next Beta Phase built on Nitro and Vinxi we are closing all PRs/Issues that will not be merged due to the system changing. If you feel your issue was closed by mistake. Feel free to re-open it after updating/testing against 0.4.x release. Thank you for your patience. See #1139 for more details. |
Describe the bug
There are missing imports when
moduleReslution: NodeNext
is used.Your Example Website or App
https://stackblitz.com/edit/github-gtcsmu?file=tsconfig.json,src%2Froot.tsx
Steps to Reproduce the Bug or Issue
moduleResolution
intsconfig.json
toNodeNext
.root.tsx
, noticed that some imports are broken.Expected behavior
Users should be able to import any
solid-js
packages without any problems whenmoduleResolution: NodeNext
is used.Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: