How to import third party libraris in 1.3?

I want to import Waves into my app. But AFAIK, I can’t do this:

import {Waves} from './vendor/Waves';

How can I import these third-party libraries?

I have looked up on Stackoverflow and someone suggested to use SystemJS.

checked the source?


;(function(window, factory) {
‘use strict’;

// AMD. Register as an anonymous module.  Wrap in function so we have access
// to root via `this`.
if (typeof define === 'function' && define.amd) {
    define([], function() {
        return factory.apply(window);

1.3 module system doesn’t support AMD I think, but yeah maybe you can use them with systemjs or webpack.
webpack would have the most examples, checkout webpack:webpack, for 1.3, @eXon 's next branch on github could be of interest for you.

i think it depend on where you want to import, if you want to import to server, I think that is right. but if you want to import to client you have to do wave=require(wave)in the app.browserify.js

in 1.3 it should not be necessary to use browserify. so if using browserify is a solution, then it is a solution for importing AMD modules, like systemjs and webpack, that requires a package in addition to 1.3 modules.

1 Like

Here’s something that I’m confused. What’s the difference between modules in Meteor 1.3 and webpack? and SystemJS? Should I be using webpack with Meteor 1.3?

I apologize for these noobie questions. I’m still in the process of learning these technologies.

meteor 1.3 support ES6/2015+ modules (and CommonJS?)

webpack and systemjs also support other module formats such as AMD.

the community should move to standardise on ES6 modules over time.
However, until then, and if you really need a module that is not ES6, but AMD based, you’d need a more advanced bundler like webpack which currently has more features than the basic bundler of meteor.

Thank you @casperandersen for correcting me, I was using react from meteor and have to use browserify to import all the npm modules that require react from Meteor.

Thank you for your tip! I got it working with this:

import Waves from './vendors/waves/waves';

No curly bracket around Waves.

ohh, so it wasn’t an AMD module or AMD modules are supported? hmm, ok thanks for your tip! :smile: