Meteor Client Bundler
raw JSON → 0.6.0 verified Sat May 09 auth: no javascript maintenance
A CLI tool and module bundler that combines Meteor Atmosphere packages into a single JavaScript module for use outside of the full Meteor platform. Version 0.6.0 is the latest stable release (last release in 2018). It uses the Meteor command-line tool to resolve and bundle packages, producing a standalone file that provides Meteor's client-side API (including DDP). Key differentiator: it enables frameworks like Angular CLI, React Native, or Ionic to use Meteor's real-time data features without running a Meteor server. Compared to alternatives like `ddp-client`, this bundles full Meteor client runtime including accounts and file upload packages.
Common errors
error Error: Can't resolve 'meteor-client' ↓
cause The module is not installed or the import path is incorrect.
fix
Ensure you have run
meteor-client bundle and the output file path matches your import. For example, if bundled to meteor-bundle.js, import from './meteor-bundle'. error Meteor is not defined ↓
cause Using the module before calling Meteor.connect or not importing correctly.
fix
Call
import { Meteor } from 'meteor-client'; Meteor.connect('...'); and ensure the connection URL is reachable. error Error: The package 'meteor-base' was not found in the Meteor universe ↓
cause The specified Meteor release does not include the required packages or the release is not installed.
fix
Check the
release field in config; ensure Meteor is installed and the release exists. Use meteor update to fetch releases. Warnings
breaking The module exports have changed in v0.6.0: Meteor is now an ES module named export, not a default export. ↓
fix Change `import Meteor from 'meteor-client'` to `import { Meteor } from 'meteor-client'`
gotcha The bundler requires the Meteor CLI tool to be installed globally; without it, `meteor-client bundle` will fail. ↓
fix Install Meteor: `curl https://install.meteor.com/ | sh`
deprecated The `--url` command-line option is deprecated in favor of the `runtime.DDP_DEFAULT_CONNECTION_URL` config field. ↓
fix Use `"runtime": { "DDP_DEFAULT_CONNECTION_URL": "..." }` in the config file
gotcha The bundled module does not work in browser environments that do not support ES modules natively. ↓
fix Use a bundler like webpack or rollup to transform the output, or set the output to CommonJS via the config (not documented).
Install
npm install meteor-client-bundler yarn add meteor-client-bundler pnpm add meteor-client-bundler Imports
- Meteor wrong
import Meteor from 'meteor-client'correctimport { Meteor } from 'meteor-client' - Accounts wrong
const Accounts = require('meteor-client').Accountscorrectimport { Accounts } from 'meteor-client' - Mongo
import { Mongo } from 'meteor-client' - require('meteor-client') wrong
const meteor = require('meteor-client'); // returns an object, not a functioncorrectconst MeteorClient = require('meteor-client'); const { Meteor } = MeteorClient;
Quickstart
// Install meteor-client globally
npm install -g meteor-client-bundler
# Create a config file meteor-client.config.json
{
"release": "1.9",
"runtime": {
"DDP_DEFAULT_CONNECTION_URL": "http://localhost:3000"
},
"import": ["meteor-base"]
}
# Run bundler
meteor-client bundle --destination meteor-bundle.js
# In your app
import { Meteor } from './meteor-bundle';
Meteor.connect('http://localhost:3000');
Meteor.call('myMethod', (err, res) => {
if (err) console.error(err);
else console.log(res);
});