Angular CLI + Meteor — No more ejecting Webpack Configuration

Arda Tanrikulu

Previously, we have to eject Webpack configuration generated by Angular CLI to modify module aliases for Meteor’s special import syntax such as meteor/meteor and meteor/mongo etc. However, this is not required after the latest release of Meteor Client Bundler. Now, MCB can create stub modules for these imports.

Quick Start

Check out the example in angular-meteor.

How to Add Meteor Client to Your Existing Project

  • After installation of meteor-client-bundler:
yarn add meteor-client-bundler --dev
// or
npm install meteor-client-bundler --save-dev
  • Add meteor-client.config.json with the necessary options:
meteor-client.config.json
{
  "runtime": {
    "DDP_DEFAULT_CONNECTION_URL": "http://localhost:3000",
    "ROOT_URL": "http://localhost:3000"
  },
  // This option enables the generation of stub modules
  "generateNodeModules": true
}
  • After that, don’t forget to add generated meteor-client.js to angular.json:
{
  "scripts": ["node_modules/meteor-client.js"]
}
  • Optionally, you can add postinstall script to generate all modules in every node_modules generation; because yarn or npm may remove your generated modules from this directory.
package.json
{
  "scripts": {
    "postinstall": "meteor-client bundle -s <PATH-TO-METEOR-PROJECT>"
  }
}
  • Ready to use!

Thank you for reading my blog post about using Angular CLI with new MCB. I’d appreciate your claps to this post if you like it.

Join our newsletter

Want to hear from us when there's something new?
Sign up and stay up to date!

*By subscribing, you agree with Beehiiv’s Terms of Service and Privacy Policy.