Skip to content

Make it compatible with Node's ESM imports. #4806

Closed
@navaru

Description

@navaru

Currently if I run a compiled svelte app in esm format on node for SSR I get the following error:

node --experimental-modules --experimental-json-modules --es-module-specifier-resolution=node svelte.app.mjs (node v14)

import { create_ssr_component } from 'svelte/internal';
         ^^^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module 'svelte/internal' does not provide an export named 'create_ssr_component'

To fix that issue I added type: "module" to node_modules/svelte/package.json, but the svelte/compiler is compiled in umd format and throws an error:

import compiler from "svelte/compiler";
       ^^^^^^^^
SyntaxError: The requested module 'svelte/compiler' does not provide an export named 'default'

Can we change how svelte/compiler is built, to something similar to svelte/internal?

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting submitterneeds a reproduction, or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions