-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ES6 modules don't work in DDC, remove library-root, module-root #32272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Synthesizing/revising my proposal from the original thread: I propose that the
I also propose an
|
did you mean "./lib" here, because of the rule "with a ./ prefix"
Yeah, I need to double check the status of this in browsers. At one point it seemed like explicit relative path syntax was required. In any case, I agree with your point in 3--since browsers only support relative paths, it's nice to use that across all of our module formats for consistency. |
Yep, fixed, good catch. |
https://dart-review.googlesource.com/c/sdk/+/42892 addresses the library name export bug. Need another CL for the module-root issue. |
We use renamable variables for Dart libraries, this ensures we still export it with the correct name. Change-Id: I96dc161e33d265c0ffbd07f8d642629504dffe62 Reviewed-on: https://dart-review.googlesource.com/42892 Commit-Queue: Jenny Messerly <[email protected]> Reviewed-by: Vijay Menon <[email protected]>
the export name issue is fixed in 1b9b345 ... library-root CL is under development, and module-root still needs to be looked at. |
progress on deprecating module-root: https://dart-review.googlesource.com/c/sdk/+/64823 It appears the option of passing the import name was already implemented (though it needed some refactoring). For example Next up is bringing these new options over to |
Adds an option for specifying the output JS module name if that is needed (only applies for some module formats). Also removes repl-compile (it's set via API, not the command line). Refactors dartdevk options to match dartdevc so we can migrate more easily. Moves shared code into a shared location and removes copied code. Change-Id: I966343ecbbc962f5d0f14ea7e65d78660159f420 Reviewed-on: https://dart-review.googlesource.com/64823 Commit-Queue: Jenny Messerly <[email protected]> Reviewed-by: Bob Nystrom <[email protected]>
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 removemodule-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 handleTemporaryId
names and generateas
when needed.(Original proposal/discussion here: #27262)
The text was updated successfully, but these errors were encountered: