themeteorchef / bert

A client side, multi-style alerts system for Meteor.
185 stars 27 forks source link

Removed Bert now jQuery is not defined #49

Closed mgscreativa closed 7 years ago

mgscreativa commented 7 years ago

Hi! I have removed Bert from my project and now I get jQuery is not defined. I think the issue arrises because of some template custom JS that needs to be placed on /client/js.

I have added jquery to my package.json, and tried to import jquery with import $ from 'jquery'; in client startup with no luck.

Thanks in advise!

themeteorchef commented 7 years ago

This wouldn't have much to do with Bert. If you're using jQuery code anywhere in your project, you'll need to import jQuery into that/those files. To make it less difficult, you can also try adding the jQuery Meteor package with meteor add jquery which should make it global to your app.

mgscreativa commented 7 years ago

Cool, I did add the jquery pakage to meteor and now works!

Newbie Question: I have added jquery trough packages.json, and imported it in the client startup file like this import $ from 'jquery';. Why that didn't worked out?

themeteorchef commented 7 years ago

@mgscreativa depends on the context of where it's in use. If you're directly referencing $ in the file where you're importing it should work okay, but if $ is expected as a global (afaik this is true in some parts of Meteor), it won't work as it needs to be imported; no global $ is exposed, even when you perform the import on the client.

mgscreativa commented 7 years ago

Cool, thanks!