How to import js file from npm package to meteor

Excuse me for novice question but how I should properly import js script to my meteor project from NPM package?

I installed Muuri package via NPM. To use it I should put muuri.min.js in html body. How i should do it? Just use @import or somehow else?

Welcome @copylefter!

To import js files from npm, you can use the bare package name like so:

import Muuri from 'muuri'; 

Meteor / node is then smart enough to look inside node_modules where npm installs it and grabs the main file described in the package.json of that package.
In Muuri's case this points to the unminified version for use in development. When you bundle your app for production with Meteor, it will automatically be minified along with your application code.

The Muuri package uses a default export (Which their readme sadly fails to specify for usage with a bundler), which is why you don’t need to wrap the imported symbol in curly braces like you need to do for Meteor packages (example import { Meteor } from 'meteor/meteor';).

You can find more information on using npm packages with Meteor here:

And I also recommend having a quick read on the different forms of import and export syntax for ES6 modules here:


Thank you so much for such detailed answer. I thought Meteor will add js file from npm somewhere across other script tags after start of the body tag and was disappointed when didn’t find it in the dom. But now I see that it works more trickier.