Missing web/index.html_bootstrap.dart.js at dart-polymer project - dart

I have a dart project using polymer. When I call pub build or select "Run as JavaScript" on web/index.html the generated build/web/index.html has the following line at the end:
<script src="index.html_bootstrap.dart.js" async=""></script>
But I can't find index.html_bootstrap.dart.js anywhere.
From my pubspec.yaml:
dependencies:
browser: 'any'
core_elements: '>=0.6.0+4 <0.7.0'
paper_elements: '>=0.6.1 <0.7.0'
polymer: '>=0.15.5 <0.16.0'
polymer_expressions: '>=0.13.0+1 <0.14.0'
transformers:
- $dart2js:
$include: lib/*.dart
csp: true
- polymer:
entry_points: web/index.html
csp: true
How and when is index.html_bootstrap.dart.js generated?

AFAIR this script selects if Dart or JS source should be loaded but pub build doesn't support Dart ouput for client code yet.
I think this transformer removes this tag https://pub.dartlang.org/packages/dart_to_js_script_rewriter (didn't try it myself yet)

This is caused by $dart2js transformer, remove this transformer and then build again.
dependencies:
browser: 'any'
core_elements: '>=0.6.0+4 <0.7.0'
paper_elements: '>=0.6.1 <0.7.0'
polymer: '>=0.15.5 <0.16.0'
polymer_expressions: '>=0.13.0+1 <0.14.0'
transformers:
- polymer:
entry_points: web/index.html
csp: true
or put $dart2js after polymer transformer:
dependencies:
browser: 'any'
core_elements: '>=0.6.0+4 <0.7.0'
paper_elements: '>=0.6.1 <0.7.0'
polymer: '>=0.15.5 <0.16.0'
polymer_expressions: '>=0.13.0+1 <0.14.0'
transformers:
- polymer:
entry_points: web/index.html
csp: true
- $dart2js:
$include: web/index.html_bootstrap.dart

Related

DART pubspec.yml error with html and bootstrap package

I get error with the bootstrap version 3.3.7. When I update bootstrap to 4.0.0, error goes away but I do not want to update as there are lot of breaking changes.
Resolving dependencies...
Package html has no versions that match >=0.12.2+1 <0.13.0 derived from:
- analyzer 0.29.11 depends on version >=0.12.0 <1.14.0
- angular 4.0.0+2 depends on version >=0.12.0 <0.14.0
- dart_to_js_script_rewriter 1.0.1 depends on version ^0.12.2+1
This is my pubspec.yml
environment:
sdk: '>=1.24.0 <2.0.0'
dependencies:
angular: ^4.0.0+2
angular_forms: ^1.0.0
angular_router: ^1.0.2
angular_components: ^0.6.0
json_object: any
http: any
html: any
angular_dart_ui_bootstrap: '>=0.0.1'
ng_bootstrap: ^0.8.5
bootstrap: "^3.3.7"
dartson: "^0.2.7"
browser_detect: "^1.0.4"
archive: "^1.0.33"
build: "^0.11.0"
intl: "^0.15.6"
stream_transformers: "^0.3.0"
rxdart: "^0.10.2"
dev_dependencies:
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
test: ^0.12.0
angular_test: ^1.0.0
transformers:
- dartson
- angular:
entry_points:
- web/main.dart
- test/**_test.dart
test/pub_serve:
$include: test/**_test.dart
dart_to_js_script_rewriter

Proper use of dart transformer

I have the following line in my pubspec.yaml file
transformers:
- di
- polymer:
entry_points: web/index.html
di package is imported as a depency - no problem there.
When I attempt an 'Upgrade Dependencies' the following error results
No dependencies changed.
Error on line 29, column 3 of pubspec.yaml: A transformer map must have a single key: the transformer identifier.
- polymer:
^^^^^^^^^
I have looked at other examples that seems similar to mine, including https://www.dartlang.org/tools/pub/assets-and-transformers.html#specifying-transformers but is unable to correct the error.
Thanks for helping.
Remove the indentation before the transformers like
transformers:
- di
- polymer:
entry_points: web/index.html

How to migrate to Polymer and PaperElements 1.0 using pubspec.yaml

I have found Migration guide (https://www.polymer-project.org/1.0/docs/migration.html). My Dart project does not use bower but pubspec.yaml and when I changed dependencies version for PaperElements I get message: paper_elements has no versions that match >=1.0.0
environment:
sdk: '>=0.8.10+6 <2.0.0'
dependencies:
browser: '>=0.10.0+2'
code_transformers: any
core_elements: '>=0.6.0'
dnd: any
logging: '>=0.9.3'
paper_elements: '>=1.0.0'
polymer: any
polymer_intl: any
vector_math: any
transformers:
- polymer:
entry_points:
web/index.html
inline_stylesheets:
packages/polymer/src/build/log_injector.css: false
- $dart2js:
minify: true
How to upgrade?
update
https://pub.dartlang.org/packages/polymer_elements
(ignore the deprecated comment in the readme)
original
There are no 1.0 elements for Dart yet.
This is work in progress and before they are not published there is no way to use them the way you did previously.
You can use the Polymer.js elements in the meantime of course but then you have to use bower and dart-js-interop.

Pub get 'Connection closed before full header was received' Angular + Polymer

I am trying to get packages from the PUB with the following:
name: 'ch_padart'
version: 0.0.1
dependencies:
angular: "1.1.0"
angular_node_bind: any
polymer: ">=0.15.5+2 <0.16.0"
core_elements: ">=0.6.0+4 <0.7.0"
paper_elements: ">=0.6.1 <0.7.0"
web_components: ">=0.9.0 <0.11.0"
browser: ">=0.10.0+2 <0.11.0"
dev_dependencies:
unittest: ">=0.11.0+5 <0.12.0"
mock: ">=0.11.0+2 <0.12.0"
transformers:
- angular:
html_files:
- web/index.html
- polymer:
entry_points: web/index.html
lint: false
but the end result is always 'Connection closed before full header was received'
If you remove angular OR polymer (and elements) and then run pub get, there is no issue and all download and runs fine. No other warnings are displayed and --verbose yields nothing helpful that I can see.
When you run pub get -v from command line you will see that pub is working quite hard but can't find a compatible set of dependencies. There was a similar issue recently that the I guess the collection package was required in different dependencies with non-overlapping version constraints.
This is quite common when using Angular with Polymer.
You might need to investigate the dependencies manually to find the cause.
Maybe you get some feedback from pub get when you remove all dependency constraints and then start adding them again one by one.
the pubviz packages helps to resolve this kind of issue as well: https://pub.dartlang.org/packages/pubviz

How do I pass multiple entry_points to polymer transformer in pubspec.yaml?

Now that pub build supports building Polymer apps, how do I pass multiple entry_points to the Polymer transformer in my pubspec.yaml file?
When I try to build with this syntax both files have errors:
transformers:
- polymer:
entry_points: web/reports.html, web/index.html
And when I try passing them in the following manner, only the last listed entry point is built:
transformers:
- polymer:
entry_points: web/index.html
entry_points: web/reports.html
In YAML, a sequence is created by wrapping a comma separated list in square brackets [ 0, 1, 2, ] or by putting each entry on a line by itself prepended by a hyphen - So your example would look like this:
transformers:
- polymer:
entry_points: [ web/index.html, web/reports.html ]
Or this:
transformers:
- polymer:
entry_points:
- web/index.html
- web/reports.html

Resources