Questions tagged [dart2js]

The Dart to JavaScript compiler that reads a Dart file and translates it to JavaScript.

The Dart to JavaScript compiler that reads a Draft file and translates it to JavaScript. It generates JavaScript source code from the Draft files. The name of the tool used to compile the code is draft2js. Dart Editor uses dart2js behind the scenes whenever Dart Editor compiles to JavaScript. It produces a file that contains the JavaScript equivalent of the Dart code. It also produces a source map, which can help to debug the JavaScript version of the app more easily.

196 questions
2
votes
1 answer

Dart2js error line numbers not accepted by source-map

I am trying to get useful errors out of dart2js generated javascript. By placing this code in my index.html: window.addEventListener( 'error', function(e){ ga( 'send', 'event', 'JS Error', …
Hendrik Jan
  • 4,396
  • 8
  • 39
  • 75
2
votes
1 answer

Dart Mirrors in JS: type '_ListConstructorSentinel' is not a subtype of type 'int'

The following code executes fine on the VM, but fails with "'_ListConstructorSentinel' is not a subtype of type 'int'" when converted to javascript via Dart2JS. I'm using "pub run test -p chrome " to run the code. import "dart:mirrors"; main() { …
Jim Simon
  • 388
  • 2
  • 9
2
votes
1 answer

compiled dart code not running in IE 10 and IE 11

I am having trouble with a small dart app which runs perfectly fine in Chrome and Firefox and... guess what.... not in IE 10 and 11 (Project Spartan in Win10 Preview works!). It is a simple UI controll logic like so: ... //init…
2
votes
1 answer

AngularDart Transformation/Deployments

I am building a client/server app in Dart using Angular for the front-end and Shelf on the backend. When I do a pub build it generates the javascript for the Dart files as expected but is does not replace the dart references in my HTML files. So in…
Gus
  • 649
  • 5
  • 14
2
votes
1 answer

dart2js and dart2dart on build

I am trying to build but I have this situation Files in bin are server files and don't need to be compiled to js. Server files us async/await while client files don't. The server is run with the --enable-async VM option. Client files should be…
Cristian Garcia
  • 9,630
  • 6
  • 54
  • 75
2
votes
1 answer

Dart2JS and Enumerators

I'm using enumerators (experimental) in my project. Pub Build (Generate JS) in my Dart Editor does not work due to the enums. In my console, this command: dart2js file.dart --enable-enum does work, but it is inconvinient to do it through the…
Vilda
  • 1,675
  • 1
  • 20
  • 50
2
votes
2 answers

Polymer elements not working after pub build - Did I forget something?

so my Polymer.Dart project is running fine in Chromium (running on Dart code) but when I pub upgrade and pub build the sampler-scaffold keeps working but paper-button, paper-dialog, paper-progress... elements are just not showing up! My HTML file…
Shady
  • 794
  • 2
  • 8
  • 23
2
votes
1 answer

DART pub get failed after update from 1.60 to 1.72: Failed to precompile intl:extract_to_arb

Last night, I accidentally updated my Dart Editor and SDK version from 1.60 to 1.72. Accidentally meaning I didn't want to change my development environment while I was developing, but it happened. After that, I see this when I try to "pub…
Paul Chung
  • 21
  • 1
2
votes
1 answer

Does dart2js support ecmascript 6 compilation?

Does dart2js support compilation to ecmascript-6 version of javascript? How do you compile to it ? If not, is it planned ? This raises another issue for js devs. If this is done would it rely on different set of shims to work with (dart2js…
user568109
  • 47,225
  • 17
  • 99
  • 123
2
votes
0 answers

Polymer Dart 0.10.0 : "Resource interpreted as Script but transferred with MIME type application/dart" whereas trying to run as Javascript

I have a polymer 0.10+ web app that works in Dartium (Dart VM) and worked until Polymer 0.10.0-pre.12. When I compile it to JS (Pub Build) and run it as JS under Google Chrome, my polymer (big) component doesn't appear and I have this message in…
KuroTenshi
  • 33
  • 6
2
votes
0 answers

What is the .precompiled.js file dart2js produces?

There’s a .precompiled.js file along .js and .js.map files the dart2js compiler produces. Compiling the code void main() { print('Hello, stranger.'); } results in identical .js and .precompiled.js files except that the latter contains the extra…
Joó Ádám
  • 909
  • 1
  • 11
  • 22
2
votes
1 answer

Blinking during of rendering pages with custom elements (FOUC issue)

I use dart-polymer package to create custom elements. I have noticed that there is some blinking during of page with the custom elements loading. This effect also is visible for the very simple ClickCounter app. Is there any way to avoid this vexing…
Roman
  • 2,145
  • 4
  • 26
  • 33
2
votes
2 answers

Turn off dart2js during pub build

I am writing a custom transformer for pub build. I would like to turn off compilation of dart files to js during debugging of the transformer to save time. Is it possible? Currently, my simplified pubspec.yaml is name: my_proj dependencies: …
Roman
  • 2,145
  • 4
  • 26
  • 33
2
votes
1 answer

How do you use polymer for dart as javascript?

I've got the dart-sdk, updated my path to include the dart binaries, downloaded the tutorials and grabbed its dependencies by running "pub get". I'm going to lean toward using dart2js until dartium integrates fully with chromium, and using dart2js…
rino
  • 491
  • 5
  • 12
2
votes
2 answers

Speeding up Dart2JS compilation

Is there any way to get the Dart2JS compiler to minimize time to output in any significant way? For example, is it possible to get it to compile only files which have been changed since the last compilation? For context, I am experimenting with…
csvan
  • 8,782
  • 12
  • 48
  • 91