Hi everyone, I’m new here and I’m a Laravel developer but I started to use Meteor on my new project.
The thing is that I’m very confused about using NPM dependencies. I managed to install Npm packages the way it’s meant to be:
meteor npm install --save package
Later I chek if packages.json has the new package and if its installed in node_modules folder.
I used import for some libraries but it doesn’t seem to be working correctly. If I import Jquery it still uses a Jquery that I guess it’s from atmosphere even though I want to use a different version and from Npm.
The only .js files that I find in the HTML code (inspect element from Chrome) are those that belongs to packages from meteor atmosphere.
So I’m guessing that I’m not importing Npm packages in the right way.
if you’re using blaze, jquery is a special case as it’s provided as a dependency of blaze via it’s atmosphere package.
If you install jquery using npm, the atmosphere package will use the version you installed with npm (but still ship both version to the client )
Apart from that, all npm modules can be used with import or require
Are you having a specific issue you need help with?
Thanks again @coagmano, I’m actually using import for Jquery and other libraries. Not all of them work, I suppose it’s because Jquery v1.11.2.
By now I’m trying to import Jquery in /imports/startup/client/index.js (using meteor 1.5.2 and the structure that comes along with a brand new installation):
import jQuery from 'jquery';
Doesn’t give me any error, but how do I know that it’s working. How can I check the version (or versions) that meteor ships. By analizing the html, I can only figure out that it’s loading at least packages/jquery.js and it’s the version 1.11.2.
And thanks again @coagmano, that was very useful, with that command I was able to know what version of jquery was runnning. So I changed the version of npm-jquery from package.json and it was always the npm one.