dart_to_js_script_rewriter icon indicating copy to clipboard operation
dart_to_js_script_rewriter copied to clipboard

" zero or multiple dart scripts" error

Open proteme opened this issue 9 years ago • 5 comments

Even though I have reference to a single dart script, I get the following error on "release" build.

[Error from ScriptCompactor on Project|web/index.html]:
Found either zero or multiple dart scripts in the entry point `web/index.html`. Exactly one was expected.

I do have references to two other JavaScript scripts in the same index.html.

I am not sure if I am doing something wrong, or this is a bug.

proteme avatar Sep 27 '15 03:09 proteme

I may be mistaken, but I think ScriptCompactor is actually part of the DartSDK. This is an SDK bug, not dart_to_js_script_rewriter bug.

FaisalAbid avatar Sep 28 '15 14:09 FaisalAbid

Can you please post your pubspec.yaml ?

sethladd avatar Sep 28 '15 18:09 sethladd

Thanks, Faisal and Seth.

Here is my pubspec.yaml:

name: Project
version: 0.0.1
author: <Hesh> <[email protected]>
description: Check those boxes
homepage: http://proteme.org/Anton
environment:
  sdk: '>=1.0.0 <2.0.0'
dependencies:
  browser: any
  core_elements: any
  firebase: any
  intl: any
  js_bridge: any
  paper_elements: any
  polymer: any
  string_tokenizer: any
  uuid: any
  test: any
  dart_to_js_script_rewriter: any
transformers:
- dart_to_js_script_rewriter
- polymer:
    entry_points:
    - web/index.html
    - web/rules.html
- $dart2js:
    commandLineOptions: [--enable-experimental-mirrors]

I also tried with removing one of the entry points, but with same results.

proteme avatar Sep 28 '15 19:09 proteme

I see the same error in a polymer 1.0 application if I put dart_to_js_script_rewritter as the first transformer. Putting it after web_components makes it so the error doesn't appear but then the transformer doesn't seem to be doing its job as both script tags are still there.

donny-dont avatar Nov 19 '15 04:11 donny-dont

ah, the issue here is the dart_to_js_script_rewriter transformer should come after the polymer transformer. The ScriptCompactor is one of the Polymer phases, it looks in your entry point html for dart script tags and html imports, and bootstraps the app with a single dart file that imports all reachable dart files.

jakemac53 avatar Nov 20 '15 15:11 jakemac53