Require vs import in Meteor 1.3

Hi guys!

I’m trying to learn the difference between require and import, and how is the best way to use NPM in meteor, but I’m having spotty issues. Sometimes meteor reset fixes it, sometimes not. Like this one:

meteor create npm-test --release 1.3-beta.11

in server/imports.js

import gsheet from 'google-spreadsheet';

this makes the app crash. If I use require it’s ok:

var gsheet = Npm.require('google-spreadsheet');

So when should I use require, and when import?

1 Like

npm i google-spreadsheet --save inside root project directory
then on the server
import gs from 'google-spreadsheet' // works
let gs = require('google-spreadsheet') // works too

1 Like

no it doesn’t work for me. Neither import nor plain require. I need to use Npm.require or the app crashes.

I’m using beta 11, with modules installed, what are you using?

it seems like a widespread issue

I am using beta.12, but it doesnt work in a new clean project. May be it works when you have mime and request already installed/

1 Like