Skip to content

ES6 modules don't work in DDC, remove library-root, module-root #32272

Open
@jmesserly

Description

@jmesserly

There are two problems:

DDC imports with unqualified names like "foo" instead of relative paths like "./foo". While this is supported by existing JS module systems, it is not supported by built-in ES6 module loaders. We also need to remove module-root because it's not the right UX. Instead we should allow the user to provide the JS import path along with a summary for that module, with some sort of default behavior (probably flat modules: "./module_name"). We'll also need a way to provide the SDK import path.

The other problem is with library names. They are exports of temporary identifiers, which can be renamed, breaking the module's ABI. It works in existing JS module systems, because DDC desugars ES6 export into a renamed local and a non-renamed export. We should be able to fix this by using export as. I think import already has a way to handle TemporaryId names and generate as when needed.

(Original proposal/discussion here: #27262)

Metadata

Metadata

Assignees

Labels

area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.dev-compiler-uxtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)web-dev-compiler

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions