Skip to content

BuildWebCompilers can't serve several dart apps on one page, compiled via DartDevC #2023

Open
@yury-yufimov

Description

@yury-yufimov

We've tried this one not on latest libs, but I doubt it's already fixed. Current versions:

DartSDK: 2.0.0
build: 1.0.0
build_runner: 1.0.0
build_runner_core: 1.0.1
build_web_compilers: 0.4.4

Also, we're still not using build.yaml files, but custom configured builder set. Anyway, here's the situation.

We are trying to separate our application into several dart entry points. At first we include into page some host-app.dart.js, then it decides to include another some-app.dart.js
When apps are compiled via dart2js, everything's ok: both main functions are started.
But DDC uses require.js, and here's the problem:

  1. host-app.dart.js includes into page script
    <script defer src="packages/$sdk/dev_compiler/amd/require.js" data-main="https://localhost/host-app.dart.bootstrap"></script>
  2. requirejs is loaded, then it starts to load it's "data-main" script, which contains compiled main function from host-app.dart
  3. Our logic in it includes into page some-app.dart.js
  4. It adds to page
    <script defer src="packages/$sdk/dev_compiler/amd/require.js" data-main="https://localhost/some-app.dart.bootstrap"></script>
  5. Second requirejs script doesn't start main function from some-app.dart !

To answer possible questions:

  • One entry point with deferred import of components from some-app.dart is not an option here: we need strong isolation of libs, that can be used in host-app and some-app.
  • Dart Isolates are also hardly suitable - we want a way for some-app to use any version of libs, frameworks or even DartSDK, different from ones in host-app

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions