How can i detect / use meteor from npm packages?

hey, i moved a bunch of stuff into an npm package so that it can be used by scripts and other javascript things in the project, so i went to put conditionals around the Meteor stuff, but it doesn’t seem to work…

i’m trying to do something like

let Meteor;
try {
  Meteor = require('meteor/meteor').Meteor;
catch (e) {
  // do non-meteor stuff
}

but even when the npm package is required in the Meteor app it can’t find meteor/meteor… i’m guessing this has something to do with how npm requires things? the meteor packages are not in it’s scope / path?

anyone know how i can accomplish this (npm package that can be used in and outside of Meteor)?

1 Like