3

I have a problem with transpiling Angular Dart application to javascript.

I got following error messages:

*Loading source assets...
Loading dart_to_js_script_rewriter transformers...
Building testapp...
Building dartdevc modules...
Unable to find module for angular|lib/src/bootstrap/modules.template.dart
Unable to find module for angular|lib/src/bootstrap/modules.template.dart
Build failed.*

Some highlights:

  1. Application works fine with build_runner
  2. I use dart SDK 2.0.0-dev.32.0
  3. I tested and get same results on Win10 and Linux Ubuntu 17
  4. I tested with dartdevc with and without

Below you can see my pubspec.yaml It could be there is an issue what I can not see.

name: testapp
description: A web app that uses AngularDart Components
version: 0.0.1

environment:
  sdk: '>=2.0.0-dev.1.2 <2.0.0'

dependencies:
  angular: "5.0.0-alpha+6"
  angular_components: "0.9.0-alpha+6"
  http: "^0.11.3+16"
  stream_transform: "^0.0.10"
  angular_router: "2.0.0-alpha+6"
  js: "^0.6.1"
  intl_translation: "^0.16.1"
  intl: "^0.15.2"

dependency_overrides:
  analyzer: ^0.31.0-alpha.1

dev_dependencies:
  webdriver: "^2.0.0-beta"
  browser: "^0.10.0+2"
  dart_to_js_script_rewriter: "^1.0.3"
  test: "^0.12.30+2"
  build_runner: "^0.7.9+2"
  build_web_compilers: "^0.3.0"

  sass_builder: ^1.1.2 # update for the latest version

transformers:
  - $dart2js:
      commandLineOptions: [--trust-type-annotations, --trust-primitives, --show-package-warnings, --dump-info, --fast-startup]
  - dart_to_js_script_rewriter

For now I have no clue how to debug the problem. Any leads will be very welcome.

Thanks!

Jakub
  • 31
  • 1
  • Could you please clarify which command is failing? Are you trying to compile with `pub run build_runner build` using dart2js, or `pub build`? – Leon Senft Mar 06 '18 at 19:43
  • Based on the output: "`Loading dart_to_js_script_rewriter transformers...`" This is `pub`. You shouldn't see a line that looks like that from `build_runner`. Check out https://github.com/dart-lang/build/blob/master/docs/getting_started.md – Nate Bosch Mar 06 '18 at 21:46
  • pub build is failing. build_runner works fine. I would like do build transformed dart to javascript for prepare our first deployment. BTW Can it prepare production deployment by build_runner? – Jakub Mar 07 '18 at 00:06
  • OK - I solved the issue. To prepare a build I used: `pub run build_runner build --config release` and `build.release.yaml` file with `compiler: dart2js` Thank you for support :) – Jakub Mar 07 '18 at 01:37

0 Answers0