Reputation: 17410
I have a Meteor 1.3 project and use some client-side libraries, installed via npm.
For example, I use Matter.js, that is installed this way
npm install --save matter-js
and used this way (CoffeScript):
{Matter, Engine, World, Body, Bodies, Composite, Composites, Svg, Events, Common, Vector} = require 'matter-js'
All imported symbols are available in code it everything is fine.
But, when I trying to install 'autosize' library:
npm install --save autosize
and use it in code (CoffeScript):
{autosize} = require 'autosize'
I get
TypeError: autosize is not a function
Maybe, I'm doing something wrong?
Any ideas?
Upvotes: 1
Views: 306
Reputation: 17410
I figured it out!
autosize library exports its autosize function using
export default autosize;
So, it should be imported this way, without curly braces (CoffeeScript):
autosize = require 'autosize'
Now autosize function is available!
I hope, it will be useful for someone.
Thanks!
Upvotes: 2