You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clarification on the modularity of Polymer within external web component scripts: Is Polymer designed in a way to export it as a (commonjs) module?
#666
Closed
lozandier opened this issue
Jul 29, 2014
· 2 comments
I'm trying to figure out how whether or not polymer library users can wrap around Polymer to make it a node-style module in order to create an external script for a web component with libraries I hope to load in as modules using browserify or a similar module tool.
my-custom-element.js
let_=require('libraryA');letPolymer=require("polymer-module");Polymer('my-custom-element',{// my-custom-element's properties and methods })
polymer-module.js (browserify-style)
module.exports = ????
I thought it would be simple as creating JavaScript or CoffeeScript file that exports the Polymer object, but apparently not since the polymer.js file begins with stuff like window.PolymerGestures={}.
Since most will import polymer.html, are we expected to not overthink it and merely import anything else we would like to add in our Polymer function declaration to define our web components however we like (requirejs, browserify, and whatever else) instead of having to account for it being anything different in our external script tags (even when minified)?
The text was updated successfully, but these errors were encountered:
As of today, Polymer itself is simply a global. I consider this acceptable given the context.
If there is a practical reason to make it importable as a module, I'd like to gather that information, but I don't believe there is a compelling rationale at the moment.
This is only for Polymer itself, individual elements can be modules or use modules from various sources using various techniques.
I'm trying to figure out how whether or not polymer library users can wrap around Polymer to make it a node-style module in order to create an external script for a web component with libraries I hope to load in as modules using browserify or a similar module tool.
my-custom-element.js
polymer-module.js (browserify-style)
I thought it would be simple as creating JavaScript or CoffeeScript file that exports the
Polymer
object, but apparently not since thepolymer.js
file begins with stuff likewindow.PolymerGestures={}
.Since most will import
polymer.html
, are we expected to not overthink it and merely import anything else we would like to add in ourPolymer
function declaration to define our web components however we like (requirejs, browserify, and whatever else) instead of having to account for it being anything different in our external script tags (even when minified)?The text was updated successfully, but these errors were encountered: