Skip to content

Meteor-Rspack integration⚡🚀#13910

Closed
nachocodoner wants to merge 376 commits intodevelfrom
modern-bundler-integration
Closed

Meteor-Rspack integration⚡🚀#13910
nachocodoner wants to merge 376 commits intodevelfrom
modern-bundler-integration

Conversation

@nachocodoner
Copy link
Copy Markdown
Member

@nachocodoner nachocodoner commented Aug 28, 2025

Context: Meteor-RSPack Integration: A Modern Bundler Meets Meteor 3.4 (Check out the forum post for additional information)

This PR adds modern bundler support to Meteor by integrating Rspack alongside the existing bundler. This brings faster rebuilds, smaller bundles, and compatibility with the modern JS ecosystem.

The changes in this PR are significant, but I will keep it open even as we release betas. This way it can continue to be reviewed, with reviews addressed and delivered as part of the beta release plan until the official release. Since this is a major integration, it needs enough time to be properly verified, reviewed, and tested, without being tied to a strict release date. The only requirement for beta releases is to have all checks passing on the PR.

Changes included

  • rspack package: orchestrates Rspack setup, development server, and production builds
  • tools-core package: utilities for installing npm dependencies and detecting Meteor runtime to use it for Rspack integration and future tool integration packages (like CapacitorJS).
  • @meteorjs/rspack npm package: provides a default rspack.config.js for Meteor. Projects can add their own rspack.config.js to extend or override it.
  • Meteor core updates: new changes to manage ignore rules, HTML boilerplate, entry points, and HMR integration
  • Test suite: validates stability across Meteor, Rspack, and tools-core in all app setups using Jest and Playwright
  • Skeleton updates: updated all Meteor skeletons to configure and use Meteor-Rspack integration.

📃 New docs for Modern Build Stack (WIP)

📏 Support Rspack for meteor profile

Getting started

Once Meteor 3.4-beta.11 is available, enable Rspack with a single command:

meteor add rspack-beta.11

When you install Rspack and run your app, your project is set up to:

  • Automatically install npm dependencies (like Rspack) at the project level. The package installs a default minimum version, so you get updates without waiting on core releases.
  • Create a _build folder for intermediate files from the Meteor–Rspack process.
  • Add public/build-assets and public/build-chunks to store Rspack assets, code chuncks from dynamic imports, and so on; and serve them in your app when building them for production.
  • Update .gitignore to ignore the new build folders.
  • Configure Meteor ignore mechanism so only Rspack processes your app code. Meteor then responds to Rspack’s output and packages, improving development speed.
  • Automatically run the Rspack dev server or build command depending on meteor run or meteor build and the environment.
  • Generate rspack.config.ts so you can customize rules for client/server, development/production, tests, and more.

Modern tests

Context: ./tools/modern-tests

We’ve built a new modern test suite to address the limitations of the current self-tests. The old suite relies on limitations on manage npm dependencies, advanced configurations, and mock behaviors that often miss real-world issues.

Modern tests runs across all skeletons, and specific modern app setups, checking key things: server responses, page rendering, dev/prod builds, tests and multiple configurations. Every test now passes as shown in the picture.

We have two kind of tests: skeleton and modern app tests. Skeleton tests are generated at runtime using meteor create. The modern app tests (eg. react-router.test.js) uses the apps statically described at modern-tests/apps to try configs not covered by skeletons, like dynamic imports, ESM, styling, Babel, swcrc configs, and more advanced setups, also those that will come in the future. As in the legacy suite, we preconfigure some apps for testing.

It's important new configs and assertions are incrementally added so that we can ensure we support more apps, and we never add regressions. This will bring stability on releases.

Roadmap

A lot of work has already been done. The remaining tasks include:

  • Verify Meteor-Rspack support in Cordova
  • Add rsdoctor support to the Meteor bundle visualizer process
  • Update docs to cover native updates, rsdoctor bundle-visualizer integration, file structure changes, etc.
  • Ensure Meteor-Rspack integration runs properly on Windows
  • Verify core CI tests and the new local test suite are green
  • Release and validate the first phase: Meteor 3.4-beta.8 🚀, Release 3.4 ⚡🚀  #13915
  • Create CI jobs to run the new tests for Meteor–Rspack integration and Skeletons, in parallel; run only on release branches or when tools/* or rspack/tools-core change
  • Address feedback... WIP

@harryadel
Copy link
Copy Markdown
Contributor

harryadel commented Oct 23, 2025

@nachocodoner pacho we've a problem!!!

I'm trying to migrate a project and have attempt to locally fork a meteor package just like we usually do but the build fails like so:

│ Adding Gitignore Entries for Meteor Modern-Tools build context directories
└─────────────────────────────────────────────────
The following entries will be added to .gitignore:
  • _build
  • */build-assets
  • */build-chunks
  • .rsdoctor
✅ Gitignore entries for Meteor Modern-Tools build context directories added
Rspack plugin error: ENOENT: no such file or directory, open '/home/harry/Projects/just-events/packages/package.json'
packages/core-runtime.js:189
            throw error;
            ^

Error: ENOENT: no such file or directory, open '/home/harry/Projects/just-events/packages/package.json'
    at Object.readFileSync (node:fs:441:20)
    at getMeteorAppPackageJson (packages/tools-core/lib/meteor.js:18:8)
    at getMeteorInitialAppEntrypoints (packages/tools-core/lib/meteor.js:94:24)
    at getInitialEntrypoints (packages/rspack/lib/build-context.js:57:30)
    at configureMeteorForRspack (packages/rspack/lib/config.js:147:30)
    at module.wrapAsync.self (packages/rspack/rspack_plugin.js:140:5)
    at processTicksAndRejections (node:internal/process/task_queues:105:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/harry/Projects/just-events/packages/package.json'
}

Node.js v22.20.0

just-events/packages migration/3.0  ?
screenshot-2025-10-23_14-11-02

As you can see, Meteor attempts to create _build and rspack configs alongside the package. FYI, the package in use is https://github.com/quavedev/analytics

@nachocodoner
Copy link
Copy Markdown
Member Author

@harryadel: When does it fail? Running tests in the local package, or during meteor run at the app root?

Share details in the command. If a script or extra steps are involved, they might affect it. I’ll try to reproduce. I have tests with local packages that don’t hit this issue, so more details will help with reproduction.

@nachocodoner
Copy link
Copy Markdown
Member Author

I think I am going to discard completely this integration. Not worth it anymore!

Just joking, closing this PR in favor of official release 3.4, which already contains all changes from here, #13915

@harryadel
Copy link
Copy Markdown
Contributor

My thoughts exactly, why do we have to track rspack in two separate PRs? Thank you for your hard work.

@nachocodoner
Copy link
Copy Markdown
Member Author

It was mainly to give the opportunity for a big change to be reviewed separately, without mixing it with other contributions or core updates. This way, we always have a clear view of the Meteor-Rspack integration changes alone. It can still be reviewed this way, but as we’re close to the official 3.4 release, let’s wrap it up.

@nachocodoner nachocodoner mentioned this pull request Nov 17, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants