-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support jspm packaging #1133
Comments
We're discussing module / dependency resolution strategies and we will probably have a better solution for this eventually. In the mean time, |
👍 |
Admittedly, it would be two less steps if they checked in the dist/polymer.html, but I don't see a major issue with jspm. |
👍 This issue is still up to date with Polymer 1.0 We need a loader plugin, similar to https://github.com/systemjs/plugin-css
I made at the moment a workaround with my gulp build chain copy all PolymerElements and remove the version within the path. But that isn't good solution IMHO |
I used
Then things like the following are possible:
I'm a bit lost as to how I then start writing Polymer code and have it bundled by JSPM ... |
We are trying to do the same, but there are some inherent problems in the way Polymer elements are setup, especially its HTML Imports folder structure. |
In case someone wants to load Polymer as pure JavaScript dependency - I did the extra work to strip all html tags automatically. It would be great if the Polymer team could do provide for us - I am happy to make a nice PR ;-)
Because it is wrapped as a proper module, you can specify Polymer a true dependency like
or
It doesn't solve the problem of injecting HTML & CSS into your module, but I hope this is the first step ;-) |
Hello, Similar to @greenify's solution and @zeitiger's suggestion I created a SystemJS plugin that does HTML imports (https://github.com/Hypercubed/systemjs-plugin-html). Works great for loading Polymer itself (which only has internal relative links) but will not work for Polymer elements. I thought about rewriting relative links within the html file on import but a) I don't see a clear way to map relative bower links to jspm paths b) script tags within the HTML import are not processed by SystemJS and therefore would need to include the full jspm_components path c) the paths would no longer be resolved on bundling. |
@greenify @Hypercubed It's great to see more explorations around a JSPM workflow being done here. For now, the Polymer team are focusing on the core library, elements and tooling and our primary package manager (Bower). For others: As we currently still use Bower for this, you may end up needing to use GitHub to pull down Polymer with JSPM ( You might also find insights into ways other folks are getting JSPM to play with Polymer by searching GitHub (https://github.com/search?q=jspm+polymer&type=Code&utf8=✓). I hope that in the not too distant future we have a better story here. JSPM rocks. |
Now that Polymer is in production, has this issue been resolved??? |
I think it might be possible to publish Polymer packages on the JSPM On Sat, 12 Dec 2015 14:31 CxRes [email protected] wrote:
|
The real solution will be to switch to ES6 module system and forget about HTML imports, the standard doesn't seem to have a bright future. |
@olanod But modules don't address deduplication of network resources like HTML Imports do ... right? While I'm excited about ES6 modules and look forward to the day when they Just Work across browsers without transpilation, I'd hate to lose out on the benefits of HTML Imports. I hope see some middle ground here. |
@miztroh: I believe JSPM does implement deduplication (My understanding, and forgive me if I am wrong, is that SystemJS does everything HTML Imports does, which is one of the arguments Firefox uses for not implementing the latter). And for those of us using SystemJS with ES6, we use a transpiler anyway. |
When I say deduplication, I mean a scenario in which multiple custom elements utilize the same resource under the hood and the browser only sends one request to fetch it instead of 2. A module loader may do something like this (I've not used SystemJS), but I'd much rather have something like that handled at the platform level instead of by a module loader. As JSPM is a package manager, I don't think it's applicable in a discussion about deduplication of runtime network requests. |
Hi, I got to this thread because I wanted to use Polymer with JSPM. I've recently started to read more about polymer, but there's something I don't understand. I'm assuming Polymer is essentially a javascript library, right? If that's true, it feels awkward to have what are essentially javascript source files in html disguise (for polymer elements, the opposite is true, so this does not apply to them). Could someone please explain me the rationale? Were polymer to be distributed as a regular js library, it'd be easier to use it with npm, jspm... or am I missing something? (Of course, the Polymer-as-a-library wouldn't address the polymer-elements relative-imports issue) |
@alex94puchades Its not rational but the rationale is that everything should be an html tag since web-components and hence polymer components are web-tags. For pure consumers this "sort of" looks nicer but I agree with you that its downright silly. |
We will be evaluating new package management solutions soon, but jspm probably won't be the answer. |
@azakus Can you possibly give us a timeline on soon or some place where we can follow the discussion on this? |
I would be nice for those using jspm package system to be able to install polymer components and not having to use bower.
The reason they don't work out of the box with jspm right now is that polymer components depend on each other using relative paths assuming there's a specific directory structure. jspm adds versioning to the directory names which breaks the importing.
I don't know if there's an easy workaround or if polymer elements could implement js modules instead of HTML imports so they can be imported from javaScript.
The text was updated successfully, but these errors were encountered: