Polymer 1.0 with Meteor - pros and cons

mwc:ecmascript transpiles es6 contents inside the imported html files. mdg’s ecmascript transpiles files with extension .js(which leaves scripts inside html files untouched) which are inside visible folders. We are putting polymer elements inside dot folder (.polymer usually) so we needed a transpiler that works specifically on imported files.

Regarding using npm modules inside polymer component check this article https://github.com/npm/npm/wiki/npm-⇔-Polymer-brainstorming-session

It would be great if you could contribute. :slightly_smiling: .

1 Like

I’m not able to understand the issue here. But regarding the reusability you can write scripts wherever you want. Inside the html file/outside the html file and add a script src. And you have bower and github for distributing the component. As of now we are not handling scripts outside the root folder. I dont see the point in supporting scripts outside root folder since they are processed by meteor by default(if not inside a dot folder)

@AndreasGalster i think u want mwc:compiler to support of webcomponents inside npm packages :worried:

Here’s an example:

I’ve loaded lodash.js and cloudinary.js (server side npm module for image uploads with cloudinary) via npm install --save packagename.

Now, lodash is quite simple. I only want to load lodash (or even better, just parts of lodash, either a section or just a specific method) where it is actually needed vs the old meteor way of loading everything at once. Why? We don’t want bloated pages using scripts we’re not actually using (Why would I want to load the cloudinary.js files anywhere except for when the user is logged in and on the page where he/she can upload images)

With npm modules and/or components that is quite simple. If the component gets loaded, the script needed gets loaded. If the component doesn’t get loaded, then the script doesn’t get loaded. Preferably we would do this via imports. Problem is: Neither script tags nor imports work when we reference outside of the .root folder. So what options do we have now. Copy & paste the node_modules folder in the root of the meteor project in the polymer root folder? Also, if I could define npm imports in my component (not sure if this makes sense with server side stuff) such as e. g. cloudinary, then cloudinary will only have to be loaded for the pages that actually require it.

Does that make sense? Or am I misunderstanding how to make meteor, polymer and/or meteor + polymer more modular?

2 Likes

@AndreasGalster Okay now I understand the problem. Checkout version 1.1.49 . You can add node_modules like this in html files <script src="../node_modules/lodash/lodash.js"/> . Thanks for the feature request. :slightly_smiling:

update

kickstart meteor polymer. meteor version 1.3 beta 12 and the latest mwc:compiler .

Loading script from folder outside the .root folder

2 Likes

@AndreasGalster New forum thread for meteor webcomponents discussions. Polymer + Meteor Support With meteor webcomponents packages