dburles / meteor-google-maps

🗺 Meteor package for the Google Maps Javascript API v3
https://atmospherejs.com/dburles/google-maps
MIT License
196 stars 49 forks source link

Make blaze dependency weak #158

Closed Floriferous closed 5 years ago

Floriferous commented 5 years ago

This PR makes blaze a weak dependency of this package, meaning that if you don't use blaze in your app, it won't pollute your bundle.

I'm struggling with the html template, meteor tells me this:

   While building package dburles:google-maps:
   error: No plugin known to handle file 'google-maps.html'. If you want this file to be a static
   asset, use addAssets instead of addFiles; eg, api.addAssets('google-maps.html', 'client').

How can I handle this?

dburles commented 5 years ago

Hey @Floriferous thanks for the PR. I wonder whether you could simply place the same condition check for the templating package when adding the google-maps.html.

Floriferous commented 5 years ago

It works well! However I'm having a hard time testing this with a blaze project (I never built anything with blaze, and never ever use global variables with Meteor).

A simple meteor repo throws saying Uncaught ReferenceError: Template is not defined, even though I added the templating package to the app.

dburles commented 5 years ago

I'd hazard a guess that it just needs to be imported in the file that you're referencing it from. import { Template } from 'meteor/templating';

dburles commented 5 years ago

Admittedly I moved off Blaze before Meteor implemented modules and I found that import in the default app scaffold 😄

Floriferous commented 5 years ago

Well of course I could just import it, but I was hoping that I just don't understand oldschool meteor magical global variable syntax :)

You'd have to import Templating just where you need it, but then you have to use require, and now Meteor complains about require is not defined, why is this so hard? 🙄

I'll just fork and completely remove blaze I guess, much faster!

dburles commented 5 years ago

Can you share the test app? the changes you made seem like it'd be no problem

Floriferous commented 5 years ago

It's simply meteor create test-app, and then I cloned my branch into the packages/ folder.

Anyways, I republished an updated version of this package here: https://github.com/e-Potek/meteor-google-maps

This made me so happy 😀

Screenshot 2019-04-18 at 13 37 14
Floriferous commented 5 years ago

Closes #157