Open
Description
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:
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>
- requirejs is loaded, then it starts to load it's "data-main" script, which contains compiled main function from host-app.dart
- Our logic in it includes into page
some-app.dart.js
- It adds to page
<script defer src="packages/$sdk/dev_compiler/amd/require.js" data-main="https://localhost/some-app.dart.bootstrap"></script>
- 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