Skip to content

ESM build imports bare "version.js" causing unresolved module in Vite/esbuild #154

@drewmo

Description

@drewmo

ESM build imports bare "version.js" causing unresolved module in Vite/esbuild/Node

Description

The ESM and CJS clients import a bare specifier version.js, which breaks module resolution in Vite/esbuild and Node. Because it’s not a relative path, bundlers/runtime treat it like a package name and fail to resolve it.

In dist/esm/Client.mjs:

import { SDK_VERSION } from "version.js";

In dist/cjs/Client.js:

const version_js_1 = require("version.js");

Both should use relative imports:

// ESM
import { SDK_VERSION } from "./version.mjs";
// CJS
const { SDK_VERSION } = require("./version.js");

Adding the relative path in my local node_modules Client.mjs resolved the problem. Please fix the path issue in your main project.

The issue seems to have been caused by ce002d9

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