dart-lang / build

A build system for Dart written in Dart
https://pub.dev/packages/build
BSD 3-Clause "New" or "Revised" License
792 stars 208 forks source link

Allow configuring `baseUrl` for DDC output #1087

Open Meai opened 6 years ago

Meai commented 6 years ago

For content scripts, the baseUrl is going to be whatever page you are on and so it will never find all these extra scripts that it's trying to load:

https://reddit.com/packages/$sdk/dev_compiler/amd/require.js net::ERR_ABORTED https://reddit.com/packages/$sdk/dev_compiler/web/dart_stack_trace_mapper.js net::ERR_ABORTED

jakemac53 commented 6 years ago

Maybe we just need a baseUrl configuration option which would be set for these scripts as well as the requireJs global config?

ghost commented 6 years ago

When a chrome extensions injects a content script into browser that references other dart files then nothing works because DDC is referencing incorrect URLs, so developer is forced to use dart2js.

But, developing chrome extensions with dart2js is slow as compared to DDC. While using dart2js When a global dart file is edited then almost entire source code have to be recompiled.

Setting a custom baseUrl for applications will ease the development process.

jakemac53 commented 6 years ago

Just to confirm, the <base> tag support doesn't solve this issue still right?

ghost commented 6 years ago

Yes, it's a partial fix, we need a better solid fix than this.

ghost commented 6 years ago

For now I keep a local copy of edited build scripts. Also note that sourcemaps don't work for scripts loaded using DDC with a different baseUrl.

The real solution would be to provide a way to configure base url for sourcemaps + DDC + service worker etc.