Skip to content
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

CDN support as build target #3486

Open
sashafirsov opened this issue Jan 27, 2020 · 1 comment
Open

CDN support as build target #3486

sashafirsov opened this issue Jan 27, 2020 · 1 comment
Labels

Comments

@sashafirsov
Copy link

sashafirsov commented Jan 27, 2020

The PolymerJS as a library along with satellites like Vaadin Elements is used in portal environments and meant to be reused across multiple apps. Unfortunately modern ES6 imports (ESM) build could not use libs from library root on server or from CDN.

Proposing to add support of CDN distribution of polymer-cli built modules.

One of possible ways: polymer.json configuration parameter cdnRootUrl mapping for modules to URLs.

{   "builds": [
    {
      "name": "esm-unbundled",
      "basePath": "https://myOrgCDN.io/my-component/esm-unbundled",
      "cdnRootUrl":{
             "@my-org/my-component":"https://myOrgCDN.io/my-component/esm-unbundled",
             "@polymer":"https://somePolymerCDN.io/polymer-3/esm-unbundled",
             "@vaadin":"https://someVaadinCDN.io/vaadin-14/esm-unbundled"
       }
}

Which during the build would substitute references to modules from relative to build root path
import "../../node_modules/@polymer/iron-ajax/iron-ajax.js";
to CDN URL
import "https://somePolymerCDN.io/@polymer/[email protected]/iron-ajax.js";

The build/esm-unbundled/node_modules/* content would be changed to fit into CDN naming convention:

  • module folder suffixed with module revision
  • internal imports changed to match cdnRootUrl mapping

The project binaries would be copied to node_modules with current module revision so they would be deploy-able to and consumed from CDN.

Related issues:

@stale
Copy link

stale bot commented Jan 26, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant