I am writing a Meteor application using ES6, and I have several subcomponents that I want to save as separate npm packages. I have a library called frog-utils that is common to all packages and contains common helper functions.
When I try to re-export the module to frog-utils, it works fine with a regular node, but Meteor complains that:
W20161114-10:12:17.483(1)? (STDERR) Error: Cannot find module './color_range' W20161114-10:12:17.484(1)? (STDERR) at require (packages/modules-runtime.js:109:19) W20161114-10:12:17.484(1)? (STDERR) at meteorInstall.node_modules.frog-utils.dist.index.js (packages/modules.js:17407:20)
(Here's an example from a regular node, in the same directory)
~/s/F/frog (ac-collab) $ node > frogutils = require('frog-utils') { color_range: [Getter], uuid: [Function: uuid], currentDate: [Function: currentDate], booleanize: [Function: booleanize], shorten: [Function: shorten], compose: [Function: compose], composeReducers: [Function: composeReducers], notEmpty: [Function: notEmpty], identity: [Function: identity], getKey: [Function: getKey] }
I write in ES6 using Babel to create output files that are exposed by the module, and ES5 seems fine to me:
var _color_range = require('./color_range'); Object.defineProperty(exports, 'color_range', { enumerable: true, get: function get() { return _interopRequireDefault(_color_range).default; } });
(ES6 string is used here)
export {default as color_range} from './color_range'
javascript babeljs meteor node-modules
Stian håklev
source share