How do I import this NPM Module to my app?


#1

I wanted to use this npm module EASY_CSV into my app like this
import Tracker from 'tracker-component'; but don’t know how to do it.

It’s not about using this particular module but how to import them when they are written the same as this.

Thanks.


#2

Maybe you need to import whole module?

import 'tracker-component'

or

import 'tracker-component' as Tracker


#3

i was talking about this https://www.npmjs.com/package/easy-csv


#4

You can just use this:

let CSV = require('easy-csv');

You don’t need to use import.

Assuming you’ve run: meteor npm install easy-csv


#5

i used the npm not meteor npm… what’s the difference between the two?


#6

Nothing, other than meteor npm uses meteor’s own bundled npm (good if you don’t have npm installed globally.


#7

I am guessing it would also download the correct package for the version of node which meteor is bundled with…
For example you might be running node 6 locally, but this would download the npm package which works with 0.10.XX
Is that right?


#8

That would make sense, although the guide doesn’t mention that explicitly.


#9

I think this was mentioned in the first talk at the latest Meteor Night Video on YouTube.

Apparently it does. (at least as far as I remember)


#10

Check out this comment on MeteorChef’s announcement for their new Base boilerplate, which is now following the 1.3 guide as well.

They had issues when trying to install that boilerplate on different machines and it turned out the npm version was the problem (pulling different versions of dependencies). They decided to only use meteor npm as a matter of convention.