How do I import this NPM Module to my app?

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.

Maybe you need to import whole module?

import 'tracker-component'

or

import 'tracker-component' as Tracker

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

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

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

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

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?

2 Likes

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

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)

1 Like

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.

3 Likes