From ca9370705cfac0e193cadc1515230385e23b7077 Mon Sep 17 00:00:00 2001 From: Cristian Necula Date: Sat, 7 Feb 2026 12:21:07 +0200 Subject: [PATCH] fix: add .js extensions to imports for Node.js ESM compatibility Add explicit .js extensions to all local imports to ensure the compiled output works correctly in Node.js ESM environments (e.g., Vitest with moduleResolution: 'bundler'). This follows the TypeScript recommendation for libraries: https://www.typescriptlang.org/docs/handbook/modules/guides/choosing-compiler-options.html#im-writing-a-library Fixes NEO-935 --- src/index.ts | 6 ++++-- src/render-hook.ts | 8 ++++---- src/renderer.ts | 2 +- src/result.ts | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/index.ts b/src/index.ts index 3de187b..5593b0e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,2 +1,4 @@ -export * from './render-hook'; -export * from './wait-until'; +// Use .js extensions for Node.js ESM compatibility +// See: https://www.typescriptlang.org/docs/handbook/modules/guides/choosing-compiler-options.html#im-writing-a-library +export * from './render-hook.js'; +export * from './wait-until.js'; diff --git a/src/render-hook.ts b/src/render-hook.ts index 675c46c..a759a5a 100644 --- a/src/render-hook.ts +++ b/src/render-hook.ts @@ -1,7 +1,7 @@ -import { mkResult, type RenderResult } from './result'; -import { mkRenderer } from './renderer'; -import { waitUntil } from './wait-until'; -import type { RenderHookOptions } from './types'; +import { mkResult, type RenderResult } from './result.js'; +import { mkRenderer } from './renderer.js'; +import { waitUntil } from './wait-until.js'; +import type { RenderHookOptions } from './types.js'; const tillNextUpdate = (addResolver: ReturnType>['addResolver']) => diff --git a/src/renderer.ts b/src/renderer.ts index c3a541d..5205d02 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -1,4 +1,4 @@ -import { RendererProps, Wrapper } from './types'; +import { RendererProps, Wrapper } from './types.js'; import { component } from '@pionjs/pion'; import { unsafeStatic, html } from 'lit-html/static.js'; import { render as litRender, TemplateResult } from 'lit-html'; diff --git a/src/result.ts b/src/result.ts index 0dab33a..8a34e2e 100644 --- a/src/result.ts +++ b/src/result.ts @@ -1,4 +1,4 @@ -import type { RenderResult } from './types'; +import type { RenderResult } from './types.js'; export type { RenderResult };