Open Legioth opened 3 years ago
Hi, I work for Skypack and I can confirm that using an export map will allow the CDN to optimize the build when multiple entrypoints are expected. If this project is now inactive then another option is for you to contribute an export map to https://github.com/snowpackjs/DefinitelyExported and we can make sure it is used in the CDN.
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.
Polymer cannot be used reliably from the Skypack CDN. By extension, any application that uses third party web components based on Polymer cannot use the new Streaming Imports mode introduced in Snowpack 3.
A simple example works as long as there's either only an import for the main module (
@polymer/polymer
) or only specific module imports (e.g.@polymer/polymer/polymer-element.js
). Mixing those two modes will lead todom-module
being defined twice - once inlined into the main bundle and once as a standalone file through the other import. Consistently using only one way of importing is possible in a limited application, but typically not when using third party components (such as almost anything from Vaadin).Fixing this would probably need a proper
exports
map inpackage.json
which would let Skypack known which modules might be loaded separately and should thus not be inlined into the main bundle. I'm making this assumption based on what I read in https://docs.skypack.dev/package-authors/package-checks#export-map - I haven't tested it in practice.Improving compatibility between Polymer and Skypack / Snowpack is mostly important because new applications started using a more modern tech stack might still want to reuse existing web components implemented using Polymer. Without a fix, they would have to find replacement components that are compatible with their tech stack.
Live Demo
https://jsbin.com/jabapumota/edit?html,console
Steps to Reproduce
@polymer/polymer
from cdn.skypack.dev@polymer/polymer/polymer-element.js
from cdn.skypack.devExpected Results
No exceptions
Actual Results
Versions