Tools: support for lazy-imports

Created on 6 Mar 2017  路  13Comments  路  Source: Polymer/tools

Currently polymer-bundler doesn't support https://github.com/Polymer/lazy-imports/ which leads to inability to build such project with polymer-cli.
Is there any hope that such <link rel="lazy-import" href="lazy-element.html" group="lazy"> imports will be bundled?

I've found a pull request https://github.com/Polymer/polymer-bundler/pull/391 for this, but it looks like incomplete.

bundler High Completed Enhancement

Most helpful comment

Just released in polymer-bundler 2.0.0-pre.13.

(Should get into release pipeline for polymer-build and polymer-cli soon.)

All 13 comments

I think you should list all lazy impors as fragments in polymer.json and they will be bundled.

@web-padawan , that's obvious but that negates the benefits of lazy-imports against importHref.

@usergenic let's talk about this on Monday and see if you need any additional support from the Analyzer. One thing could be an option to easily say whether a URL is only ever used as a lazy import, which would make it an entrypoint, or maybe an API to get a list of all inferred entrypoints.

+1

@usergenic I have been trying to create a minimal reproduction repo but am failing pretty hard. Let me reach out to my co-workers that are having the issue and see if they can work on it. Will let you know what comes of it.

I wrote tests last night to identify the current behavior with lazy imports and they're effectively treated the same as eager imports, regardless of what the code thinks it's trying to do...

I've also started on the fix to make purely lazy edges (i.e an import which is only ever imported lazily) convert to entrypoints (bundlers term for an edge or fragment). I should hopefully have a bundler PR ready for it today.

I have added a repo to replicate this issue.

Re: @jay8t6's comment, there was some confusion around which issue he was having, this seems like it is more analyzer/build. I will link it to an issue over there.

Polymer/polymer-analyzer#643

Just released in polymer-bundler 2.0.0-pre.13.

(Should get into release pipeline for polymer-build and polymer-cli soon.)

Thanks @usergenic!

Yay! Thanks @usergenic! Excited with the lazy imports support! 馃榿

Seems something is still broken here... https://github.com/stramel/lazy-import-bundle

It looked like it was working fine when I was lazily importing pages.

FYI bundler 2.0.0-pre.14 https://github.com/Polymer/polymer-bundler/pull/498 will include fix for lazy-import links being moved around out of dom-modules, for anyone encountering that issue.

Was this page helpful?
0 / 5 - 0 ratings