Skip to content

ESM builds fail for node environments #259

@tehnrd

Description

@tehnrd

The esm build command does not output .mjs files. This causes build issues in projects where the package.json type is module as builders for these projects then expect the esm imports to be a .mjs file.

This is env specific, but this is the type of error I am receiving as an example:

[vite] (ssr) Error when evaluating SSR module /src/routes/monitoring/metrics/+page.svelte: [vite] Named export 'isQueryValid' not found. The requested module '@jetstreamapp/soql-parser-js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@jetstreamapp/soql-parser-js';
const {parseQuery, composeQuery, isQueryValid} = pkg;

Switching to the suggested fix in this error message does not actually resolve the issue.

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