Skip to content

@pascal-app/ifc-converter: published ESM uses extensionless relative imports, failing in Node with ERR_MODULE_NOT_FOUND #1285

Open

Description

@trackoor

What happened?

@pascal-app/ifc-converter is published as ESM ("type": "module") and documents Node support in packages/ifc-converter/README.md ("No DOM, no React" and Node callers can pass { wasmPath: '/absolute/path/to/web-ifc/' } in ConversionOptions), but its emitted dist/*.js and dist/*.d.ts files keep extensionless relative specifiers (from './beam-geometry', from './export/guid', etc.).

Loading either @pascal-app/ifc-converter or @pascal-app/ifc-converter/export in Node fails immediately with ERR_MODULE_NOT_FOUND (and TypeScript projects using moduleResolution: "nodenext" without skipLibCheck fail with TS2835 on dist/*.d.ts). @pascal-app/core loads fine in the same install because core, geometry-script, nodes, and mcp run scripts/fix-node-esm-imports.ts after tsc --build, whereas packages/ifc-converter still runs plain tsc --build.

Steps to reproduce

mkdir repro && cd repro
echo '{"type":"module"}' > package.json
npm install @pascal-app/ifc-converter@1.1.4
node --input-type=module -e 'await import("@pascal-app/core"); await import("@pascal-app/ifc-converter");'
node --input-type=module -e 'await import("@pascal-app/ifc-converter/export");'

Actual output:

node:internal/modules/esm/resolve:241
    throw new ERR_MODULE_NOT_FOUND(
          ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to/repro/node_modules/@pascal-app/ifc-converter/dist/beam-geometry' imported from /path/to/repro/node_modules/@pascal-app/ifc-converter/dist/index.js
    at finalizeResolution (node:internal/modules/esm/resolve:241:11)
    at moduleResolve (node:internal/modules/esm/resolve:846:10)
    at defaultResolve (node:internal/modules/esm/resolve:973:11)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:708:20)
    at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:728:38)
    at ModuleLoader.resolveSync (node:internal/modules/esm/loader:766:56)
    at #resolve (node:internal/modules/esm/loader:690:17)
    at ModuleLoader.getOrCreateModuleJob (node:internal/modules/esm/loader:610:35)
    at ModuleJob.syncLink (node:internal/modules/esm/module_job:277:33)
    at ModuleJob.link (node:internal/modules/esm/module_job:389:17) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///path/to/repro/node_modules/@pascal-app/ifc-converter/dist/beam-geometry'
}

Node.js v26.13.0

await import("@pascal-app/ifc-converter/export") fails the same way on /path/to/repro/node_modules/@pascal-app/ifc-converter/dist/export/guid imported from dist/export/index.js.

Expected behavior

Both @pascal-app/ifc-converter and @pascal-app/ifc-converter/export load cleanly under Node.js (for example by running bun ../../scripts/fix-node-esm-imports.ts dist in packages/ifc-converter's build script and adding a smoke:node check like @pascal-app/core).

Browser & OS

Node.js v26.13.0, Linux x64 (no browser involved)

Screenshots or screen recordings

N/A (Node CLI reproduction)

Additional context

Reproduced on @pascal-app/ifc-converter@1.1.4 (npm latest) and main (559c0d161). Related to #861, which wired scripts/fix-node-esm-imports.ts into core and mcp. Running bun ../../scripts/fix-node-esm-imports.ts dist on packages/ifc-converter makes both ./dist/index.js and ./dist/export/index.js import and run cleanly in Node v26.13.0.

Credit: https://ucsbplse.github.io/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions