SpawnUri automatically appends ".js" when compiled to JavaScript.
How do I write a Dart web app that uses spawnUri and works with both Dartium and dart2js?
-
30-09-2022 - |
Question
I want to write a concurrent web app (using either raw Workers or isolates as workers). The Dart API for isolates is spawnUri
, which takes a URI that points to a script.
In Dartium, that script is a .dart
file. In Chrome/Firefox/etc that script is a .dart.js
file.
I need to detect what runtime I'm in so I can configure the URI for spawnUri
correctly. What is the best way to do this?
La solution
Autres conseils
How about using transformers? Here is a document about how transformers work, some Google internal documentation. There's also some info about transformers on pub pages - assets and transformers. What you could do is use transformers to output "rewrite" your files a bit to use correct url.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow