-
Notifications
You must be signed in to change notification settings - Fork 33
polymer transformer can only be used on the application package and not on a library package #368
Comments
<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch Hey Rob: The error message you see looks as if there is a broken import or we can't read a file, but it really puzzles me that you didn't see this with earlier versions of polymer. Let me ask you a bunch of questions, maybe this will help us figure it out. - If you use the linter (through build.dart), do you see an error message about it? - Where does the custom element file lives? And how was that one imported? Are these in the same package or different packages? - does the code run ok when you just open the 'web/index.html' directly in Dartium? - which version of polymer did you upgraded from? (for instance, if you just upgraded from 0.8.10+4, maybe the issue was introduced in 0.9.0 rather than 0.9.0+1?) - Does the app work if you run 'build.dart --deploy' instead? |
<img src="https://avatars.githubusercontent.com/u/3227777?v=3" align="left" width="48" height="48"hspace="10"> Comment by rbishop-bah * linter is happy, no errors
Is the import of a custom element from an outside package causing barback to execute multiple transformation phases (thus scrubbing the files needed in the last phase?) I dunno... just a guess. |
<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch I'm going to try creating samples that resemble this structure to see if I can repro anything similar. More questions (sorry I can't stop :-]): |
<img src="https://avatars.githubusercontent.com/u/3227777?v=3" align="left" width="48" height="48"hspace="10"> Comment by rbishop-bah The structure is package "stuff" and package "app", with app having index.html, app.html and app.dart. In app.html there is a link to a custom element in package stuff -- that's the one that it claims it can't find when pub build is run with Polymer 0.9.0+1. Your second question appears to have nailed the problem. I do have a polymer transformer in package stuff. It's not really an app, just a library, but I was using its web folder for testing the custom elements (actually trying to build them to JS versions so I could test those)... When I removed the transformer from package stuff's YAML, I was able to build package app again. So this is probably a pub/polymer bug. I should be able to use transformers wherever I like without hosing downstream projects, right? Or maybe the better question is what's the recommended way to set up tests for polymer custom elements because every structure I try seems to cause trouble (at least no files were eaten this time! : ). |
<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch As you posted this, I was also about to post that I found a repro case :-) So, indeed, including a 'transformers' section on an imported package is problematic. The reason is that if you have 2 packages "a" and "b" and both have a transformer section including polymer, then when polymer processes "b", it can't see "a"'s original files, it can only see the transformed files (which are hidden by the new step we added on 0.9.0+1). I'll work on a fix to at least expose what's inside lib/, but there is a bigger issue here that we need to figure out. We keep running in situations like this because of how barback treats transformers on a package-by-package basis. Polymer's transformers needs a holistic view of the packages, but barback will expose the transformed version of the code to other packages and transformers. I'll reach out to the pub/barback folks to talk more about this and see if we can come up with a better long term solution here. Attached is the small repro highlighting the issue we discussed. The code is structured as follows: test/ a/lib/a.html has something as simple as: a/pubspec.yaml: b/pubspec.yaml: b/web/index.html: Running 'pub build' on 'b' will show the error:
Commenting out the transformers section in a/pubspec.yaml fixes the error. Added Started label. |
<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch (and the actual attachment) Attachment: |
<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch I had forgotten that we had previously brainstormed about this issue. We talked some more about it today and we are leaning towards a solution based on dev_transformers (see issue dart-lang/pub#670). Then, you should be able to list polymer as a dev_transformer in all of your packages and that will be OK. Meanwhile, I'd recommend moving your tests of the "stuff" package to another package Added Triaged label. |
<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch I submitted a temporary fix in dart-lang/sdk@eca7549. Anything under lib/ will not be filtered out. The ultimate solution should be fixing issue dart-lang/pub#670. I'll keep this bug open until then. |
<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch Added this to the M9 milestone. |
<img src="https://avatars.githubusercontent.com/u/8616782?v=3" align="left" width="48" height="48"hspace="10"> Comment by clayberg Removed this from the M9 milestone. |
<img src="https://avatars.githubusercontent.com/u/405837?v=3" align="left" width="48" height="48"hspace="10"> Comment by zoechi In a recent discussion https://groups.google.com/a/dartlang.org/forum/#!topic/web/dc5xwmVo5JY (3/12) I can get it working in Dart when I change some absolute HTML-imports After changing it from Build error: If I change the import to use the packages directory of the package root instead of example/packages Build error: Any ideas how to solve this? |
<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch I think the issue you are seeing is unrelated to what this bug is tracking. It's confusing because the error message is the same in many situations: the error says that some files could not be found, but doesn't say much about why. In this original bug, the reason was because the file didn't exist (it was consumed by a previous run of the polymer transformer). In your case, I think it's because the path is not being resolved correctly. I just updated the title of this issue to make things a bit clearer. I'll take a closer look at your issue though, I'll catch up with the thread you linked above and reply there. Changed the title to: "polymer transformer can only be used on the application package and not on a library package". |
<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch Removed this from the 1.1 milestone. |
<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch Removed the owner. |
<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch Removed this from the 1.2 milestone. |
This comment was originally written by [email protected] I have the same problem, if i put my polymer elements in a separate library data-binding works but onPorpertyChanged methods are never invoked. Having the polymer elements in the web project folder everything works perfect. I have this problem working with Dart 1.3.6 and polymer 0.9.5+2 and only when compiled to JS. See more details: https://groups.google.com/a/dartlang.org/d/msg/web/wJrVlIP_eZE/yvrp4XjAd_AJ |
<img src="https://avatars.githubusercontent.com/u/405837?v=3" align="left" width="48" height="48"hspace="10"> Comment by zoechi Have you tried to add a polymer transformer configuration to the package containing the polymer elements? like
!! without any entry points !! |
This comment was originally written by [email protected] Yeah! It works ! You've made my life easier with those simple lines ! thanks! |
<img src="https://avatars.githubusercontent.com/u/405837?v=3" align="left" width="48" height="48"hspace="10"> Comment by zoechi Glad it helped. Then the days I worked to find a solution are not totally wasted ;-) |
<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="96" height="96"hspace="10"> Issue by sigmundch
Originally opened as dart-lang/sdk#15038
from Rob:
> With the only difference being the upgrade to Polymer 0.9.0+1, I'm now seeing pub build errors like this when trying to build my previously build-able projects:
> Pub build failed, [65] Building redacted...
> Build error:
> Transform ImportInliner on redacted|web/index.html threw error: Transform ImportInliner on redacted|web/index.html tried to load missing input redacted|lib/path/my_custom_element.html.
> null
> Build failed.
See: https://groups.google.com/a/dartlang.org/d/msg/web-ui/82FsDZz7tNg/-oHOqxj0kLMJ
The text was updated successfully, but these errors were encountered: