Skip to content
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

[DDC] Replace amd module system by ddc module system #52361

Open
annagrin opened this issue May 12, 2023 · 0 comments
Open

[DDC] Replace amd module system by ddc module system #52361

annagrin opened this issue May 12, 2023 · 0 comments
Assignees
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. P3 A lower priority bug or feature request web-dev-compiler

Comments

@annagrin
Copy link
Contributor

annagrin commented May 12, 2023

We currently use require.js module system (that implements the AMD API) in flutter and webdev, but AFAIK it is not currently maintained (latest release., 2.3.6, was in 2018)

DDC module system is faster and more flexible for our use (allows implementing new features like multi-app debugging, lazy build, hot restart, clearing the statics etc).

There are also some issues with require.js that would be solved by the move. Will attach the issues as we go to understand priority.

Work needed (approximately):

  • DDC

    • make sure tests run with DDC module system
    • move DDC library loading code and bootstrap & html generator to dart SDK repo
    • provide helpers for bootstrap generation
      • update builds - frontend server, build_web_compilers, blaze.
  • Flutter tools

    • use DDC module system when running frontend server
    • update bootstrap code
  • build_web_compilers

    • use DDC module system for compilation
    • update bootstrap code
  • DWDS

    • remove support for amd module system
@lrhn lrhn added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label May 15, 2023
@annagrin annagrin added the P3 A lower priority bug or feature request label May 16, 2023
@Markzipan Markzipan self-assigned this Nov 7, 2023
copybara-service bot pushed a commit that referenced this issue Nov 27, 2023
This renames 'dart_library.js' to 'ddc_module_loader.js' when referenced externally (e.g., Flutter Web).

This change is in preparation for DDC module system support in Flutter.

See: #52361

Change-Id: I47e7bfa1058114c2977529a97ec58f0659200472
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334400
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
auto-submit bot pushed a commit to flutter/engine that referenced this issue Jan 25, 2024
This is part of an ongoing effort to replace DDC's module system in Flutter Web (for hot reload support).

Side effects of this change include doubling the code generated by DDC whenever this build pathway is hit (until the full module system transition lands), but this shouldn't affect debug performance. We may be able to lock this behind a build flag if this is an issue. 

See related issue: dart-lang/sdk#52361
copybara-service bot pushed a commit that referenced this issue Jan 30, 2024
This also removes deprecated references to the DDC module system as the "legacy" module system.

This is part of an ongoing effort to deprecate the AMD module system: #52361

Change-Id: Ic32c6c6a0b7bf2c3bf0326be42cc9a88db8e303e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348183
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
auto-submit bot pushed a commit to flutter/flutter that referenced this issue Feb 24, 2024
…#141423)

### Context:

DDC modules are abstractions over how libraries are loaded/updated. The entirety of google3 uses the DDC/legacy module system due to its flexibility extensibility over the other two (ES6 and AMD/RequireJS). Unifying DDC's module system saves us from duplicating work and will allow us to have finer grained control over how JS modules are loaded. This is a a prerequisite to features such as hot reload.

### Overview:

This change plumbs a boolean flag through flutter_tools that switches between DDC (new) and AMD (current) modules. This mode is automatically applied when `--extra-front-end-options=--dartdevc-module-format=ddc` is specified alongside `flutter run`. Other important additions include:
* Splitting Flutter artifacts between DDC and AMD modules
* Adding unit tests for the DDC module system
* Additional bootstrapper logic for the DDC module system

We don't expect to see any user-visible behavior or performance differences.

This is dependent on [incoming module system support in DWDS](dart-lang/webdev#2295) and [additional artifacts in the engine](flutter/engine#47783).

This is part of a greater effort to deprecate the AMD module system: dart-lang/sdk#52361
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. P3 A lower priority bug or feature request web-dev-compiler
Projects
None yet
Development

No branches or pull requests

3 participants