0

When I compile my Polymer.Dart project to JS, I get:

--- 16-feb-2014 17:37:09 Running dart2js... ---
E:\dart\dart-sdk\bin\dart2js.bat --package-root=E:\Proyectos DART\Componentes\Carousel\bin --out=E:\Proyectos DART\Componentes\Carousel\bin\CarouselBase\carouselbase.dart.js E:\Proyectos DART\Componentes\Carousel\bin\CarouselBase\carouselbase.dart
/E:/Proyectos DART/Componentes/Carousel/bin/CarouselBase/carouselbase.dart:6:8: Error: Can't read 'package:polymer/polymer.dart' (Error reading '/E:/Proyectos DART/Componentes/Carousel/bin/polymer/polymer.dart' (OS Error: El sistema no puede encontrar la ruta especificada., errno = 3)).
(OS Error: The system can`t find the specified root., errno = 3)).
import 'package:polymer/polymer.dart';
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Compilation failed.

First, I started pub bilds and generated files. In pubspec.yaml file I added the polymer package and have added the origin of depencency, the folder containing the generated polymer.dart for pub.build. But still unable to compile.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
marcelo
  • 69
  • 6
  • 1
    Why do you set package-root to `bin`? Have you tried `pub build`? – Günter Zöchbauer Feb 16 '14 at 17:10
  • the bin folder build when you choose ->new Application -> command-line application, using dart editor. – marcelo Feb 16 '14 at 17:48
  • I wanted build a class library. – marcelo Feb 16 '14 at 17:49
  • You can't build a class library. You can only build entry pages. You can have a page in the `web` or `example` folder which you can build and still use the package as a class library for other projects. You should configure your entry page in `pubspec.yaml` like shown here http://stackoverflow.com/questions/20147030 and run `pub build` in your package directory. – Günter Zöchbauer Feb 16 '14 at 18:26
  • If you want to build a package containing polymer elements it isn't a command line app (but that doesn't matter much). If you want to build a package containing code to be used by other application packages you put all your code in `yourpackage/lib` (besides mentioned demo pages which are not intended to be reused which go in `yourpackage/example`) – Günter Zöchbauer Feb 16 '14 at 18:31

2 Answers2

1

If you have only Polymer elements without an application entry page (index.html) there is no point in compiling to JavaScript. Only applications are built to JavaScript not components. When an application uses your components and this application is compiled your components are built with it.

For compiling a Polymer application ensure all entry page(s) are listed in the entry_pages setting of the polymer transformers section.

transformers:
- polymer:
    entry_points: web/index.html

Then run pub build which generates the compiled JavaScript output in the build/web directory.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
0

You need to run pub get to install Polymer.

geppy
  • 604
  • 8
  • 10