AGENT SKILL

meteor-modern-build-stack

Use when configuring or tuning the Meteor 3 modern build stack: SWC transpiler, SWC-based minifier, modern @parcel/watcher, web-arch skipping in development, .meteorignore, and Rspack integration. Triggers on package.json "meteor": { "modern": true }, .swcrc, swc.config.js, [Transpiler] Used Babel Fallback logs, rspack.config.js, rspack.config.ts, defineConfig from @meteorjs/rspack, Meteor.compileWith* helpers, Meteor.extendConfig, Meteor.extendSwcConfig vs Meteor.replaceSwcConfig, Meteor.splitVendorChunk, Meteor.persistDevFiles, Meteor.disablePlugins, Meteor.enablePortableBuild, HtmlRspackPlugin customization, RSPACK_DEVSERVER_PORT, TOOL_NODE_FLAGS, pnpm workspaces, Rspack 2, skeleton selection, PWA, Workbox and service-worker build setup. Use this skill when asked about SWC vs Babel or Rspack configuration. Route existing-app bundler migration to migrate-to-rspack, Blaze PWA scaffolding to meteor-blaze, declarations to meteor-typescript, and jam:offline data to meteor-community-packages.

License 许可
MIT
最近更新
2026-11-12
Stars
★ 11
Forks
3

01 前言 Front Matter

name
meteor-modern-build-stack
license
MIT
metadata
{ "area": "build", "kind": "knowledge", "author": "meteor", "bundle": [ "essentials" ], "meteor": ">=3.3", "tagline": "Configure the Meteor 3 modern build stack (SWC transpiler/minifier, `@parcel/watcher`, web-arch skipping, Rspack integration).", "docs_synced_at": "2026-10-07" }
description
Use when configuring or tuning the Meteor 3 modern build stack: SWC transpiler, SWC-based minifier, modern @parcel/watcher, web-arch skipping in development, .meteorignore, and Rspack integration. Triggers on package.json "meteor": { "modern": true }, .swcrc, swc.config.js, [Transpiler] Used Babel Fallback logs, rspack.config.js, rspack.config.ts, defineConfig from @meteorjs/rspack, Meteor.compileWith* helpers, Meteor.extendConfig, Meteor.extendSwcConfig vs Meteor.replaceSwcConfig, Meteor.splitVendorChunk, Meteor.persistDevFiles, Meteor.disablePlugins, Meteor.enablePortableBuild, HtmlRspackPlugin customization, RSPACK_DEVSERVER_PORT, TOOL_NODE_FLAGS, pnpm workspaces, Rspack 2, skeleton selection, PWA, Workbox and service-worker build setup. Use this skill when asked about SWC vs Babel or Rspack configuration. Route existing-app bundler migration to migrate-to-rspack, Blaze PWA scaffolding to meteor-blaze, declarations to meteor-typescript, and jam:offline data to meteor-community-packages.

02 资源文件 6

03 SKILL.md 正文

Modern build stack

The modern build stack is two independent tracks. Enable either or both.

  1. Meteor Bundler Optimizations (Meteor 3.3+). One flag, SWC replaces Babel, SWC minifier replaces Terser, @parcel/watcher replaces the legacy watcher, development skips legacy archs.
  2. Rspack Bundler Integration (Meteor 3.4+). Atmosphere package delegates app-code compilation to Rspack. Tree shaking, ESM, code splitting via HTTP, modern bundler plugins.

Current meteor create application skeletons ship both enabled. Purposefully small or compatibility-oriented skeletons, including minimal and legacy, may omit Rspack or the modern flag. Inspect the generated package.json and .meteor/packages instead of inferring features only from the Meteor version. For existing apps, enable optimizations first, then add Rspack once the app code is standards-clean.

Enable Meteor Bundler Optimizations

Add to package.json:

"meteor": {
  "modern": true
}

This enables SWC, the SWC minifier, the modern watcher, and dev-mode web arch skipping. Each falls back to legacy when something is incompatible, so this is backward compatible.

Opt out of pieces:

"meteor": {
  "modern": {
    "transpiler": false,
    "minifier": false,
    "watcher": false,
    "webArchOnly": false
  }
}

Or scope SWC: transpiler.excludeApp, transpiler.excludeNodeModules, transpiler.excludePackages, transpiler.excludeLegacy. Accept true or an array of paths/regexes.

Verbose transpiler logs to diagnose Babel fallbacks:

"meteor": {
  "modern": {
    "transpiler": { "verbose": true }
  }
}

Look for [Transpiler] Used Babel for <file> Fallback. The common cause is nested imports; see references/meteor-bundler-optimizations.md.

Enable Rspack integration

meteor add rspack

On first run the package installs the project-level Rspack setup. App code moves to Rspack; Meteor still handles Atmosphere packages and produces the final bundle. Requires entry points in package.json and no nested imports in app code. To migrate an existing app, use the migrate-to-rspack skill.

Check .meteor/versions, package.json and lockfile. Meteor 3.6 pairs rspack@1.4.0 with @meteorjs/rspack@3.0.0, core/CLI 2.2.7. Use the release pairings and dependency minimums. Rspack transpiles TypeScript. Use meteor-typescript for declarations and checking; see checker boundaries.

Scaffolds, PWA and offline behavior

For new-app skeleton selection or framework-neutral PWA/Workbox setup, read scaffolds and service workers. Meteor 3.6 adds separate --pnpm workspace and --pwa Blaze starters; neither converts an existing app. A worker caches shell/assets, not offline Meteor data. Existing bundler migrations remain owned by migrate-to-rspack.

SWC config files

.swcrc > swc.config.js > swc.config.ts

Only the first found is used. Use .swcrc for static config, swc.config.js for environment-driven config. The file name must be exactly .swcrc, not config.swcrc.

Install @swc/helpers to externalize SWC helpers (smaller bundles):

meteor npm install --save @swc/helpers

New apps ship with this preinstalled. Normally no further setup is needed; Meteor's pipeline detects it and emits imports instead of inlining. If only a production or legacy bundle fails on a helper import, inspect Rspack-generated and final Meteor output before changing .swcrc or adding manual imports.

On a resolved SWC carrier, ERR_SWC_NATIVE_CACHE needs an absolute owned SWC_NATIVE_BINDING_CACHE on an executable filesystem. Build-cache cleanup will not repair it; see meteor-debugging.

Rspack config files

rspack.config.js | rspack.config.ts | rspack.config.mjs | rspack.config.cjs

Use defineConfig from @meteorjs/rspack. The function receives a Meteor parameter with build flags and helpers. See references/rspack-config.md for the full table and the most useful helpers (extendSwcConfig, compileWithRspack, compileWithMeteor, extendConfig, splitVendorChunk, persistDevFiles, disablePlugins, enablePortableBuild, setCache).

.meteorignore

Skip directories the bundler does not need to watch. Same syntax as .gitignore. Place at any depth; rules apply to the subtree.

docs/
design/
cypress/
scripts/
*.md
!README.md

For per-command rules, set the METEOR_IGNORE env var.

On the 3.6 pairing, read the test-ignore boundaries for ordered user exceptions, included parents and separate generated rules.

Do not copy .gitignore into .meteorignore blindly. Exclude unrelated large trees that Meteor does not need, but never match the active Rspack build context: Meteor consumes its generated main and test modules during final assembly.

Rspack also generates _build/, public/build-assets/, public/build-chunks/, and private/build-assets/. Include active suffixed variants such as build-assets-test and build-chunks-app-test on Meteor 3.5.2, plus custom context names. Add those paths to the native ignore configuration of recursive formatters, linters, typecheckers, test discovery, coverage, and IDEs. .gitignore alone is insufficient.

Minifier ownership

"modern": true selects Meteor's modern standard minifier. A third-party Atmosphere package that provides the JavaScript minifier remains part of the final Meteor assembly even when Rspack compiles app modules. Inventory custom minifier packages before migration. Keep or remove one only after comparing production output, source maps, build time, and runtime behavior.

Production legacy builds

For separate mainModule.legacy or exact architecture entries on Meteor 3.6, read architecture entry points. Earlier integrations retain their shared-client behavior.

Dev skips web.browser.legacy and web.cordova with "modern": true. Production still ships legacy by default. To drop legacy in production too, add modern to .meteor/platforms:

server
browser
modern

Memory limits

For tool-process OOM or growing watch memory, use the version-specific heap and cache checks.

Multiple instances

Meteor 3.5.2 separates development, normal test, and full-app test output within one context (_build/main-dev, _build/test, _build/app-test, plus mode-suffixed assets/chunks). This does not isolate Meteor caches, local Mongo, or ports. For separate local state or two instances of the same mode, use distinct ports and METEOR_LOCAL_DIR values; older integrations also need this for cross-mode output isolation:

PORT=3000 METEOR_LOCAL_DIR=.meteor/local-1 meteor run
PORT=3001 METEOR_LOCAL_DIR=.meteor/local-2 meteor run

Anti-patterns

  • Enable optimizations and Rspack at the same time on a legacy app. Enable "modern": true first, clean up Babel fallbacks, then add Rspack.
  • Edit files inside _build/, public/build-assets/, public/build-chunks/, or private/build-assets/. Autogenerated.
  • Assume .gitignore prevents code-quality tools from scanning generated Rspack output. Configure each tool's own ignore mechanism.
  • Copy .gitignore to .meteorignore. Git may ignore Rspack's generated handoff even though Meteor must read it.
  • Remove a custom Atmosphere minifier only because Rspack is enabled. Benchmark the final production bundle first.
  • Disable Rspack persistent cache without need. It is the default and the main rebuild-speed win. Disable only when investigating OOM or a cache-related Rspack bug.
  • Name an SWC config config.swcrc or rc.swc. Only .swcrc is read.

See also

  • references/meteor-bundler-optimizations.md
  • references/rspack-config.md
  • references/eval-cases.md
  • For converting an existing app to Rspack: migrate-to-rspack skill.

04 同仓库更多 Skills

meteor
meteor/agent-skills

migrate-to-rspack

Use when migrating an existing Meteor app to Rspack (Meteor 3.4+), or upgrading Rspack 1 to 2 on Meteor 3.6. Triggers on nested imports, mainModule entry points, server-only apps, replacing fourseven:scss / meteor/less / coffeescript / jorgenvatle:vite / zodern:melte with loaders, Svelte/TypeScript preprocessing or Lingui SWC plugin failures after upgrade, CommonJS default-import interop, module.exports in client graphs, Node built-ins in browser code, _build / build-assets / build-chunks, .meteorignore hiding handoff files, dynamic chunks under ROOT_URL, meteor.modules for CSS/HTML, resolve.symlinks or resolve.alias migration, automatic dependency updates and immutable CI/Docker builds. Use this skill when the user asks about migration compatibility or a build plugin's Rspack replacement. For new-app setup and rspack.config.js helpers, use meteor-modern-build-stack instead.

★ 11
meteor
meteor/agent-skills

migrate-to-meteor-3

Use when migrating a Meteor 2.x application to Meteor 3.x. Triggers on callAsync, *Async Mongo, removed Fibers, implicit-global ReferenceError, lost Blaze reactivity, a publish function returning a Promise, a scheduler dropping a Promise, a read API receiving update modifiers, async allow/deny, an Iron Router controller not running, "Method stub took too long", Atmosphere resolution, Express 5 WebApp handlers, lost async context, rawCollection callbacks, TypeScript declaration failures during upgrades, useTracker, and useSubscribe. Use this skill when the user asks about upgrading Meteor, async caller propagation, iterators with await, or replacing and forking packages. Standalone declarations and type-checking belong to meteor-typescript.

★ 11
meteor
meteor/agent-skills

meteor-typescript

Use when setting up or repairing Meteor application declarations, TypeScript configuration, JavaScript IntelliSense, or local and CI type-checking. Triggers on meteor types, meteor/* imports resolving to any, missing declarations, duplicate Meteor identifiers, zodern:types, @types/meteor, .meteor/types, tsconfig.json, jsconfig.json, and tsc --noEmit in a Meteor app. Use this skill when choosing or migrating declaration providers without changing the app's runtime or bundler. For a Meteor 2-to-3 runtime migration use migrate-to-meteor-3 first; for SWC/Rspack compilation use meteor-modern-build-stack or migrate-to-rspack. General TypeScript language questions and Atmosphere declaration publishing are outside this app scope.

★ 11
meteor
meteor/agent-skills

meteor-testing

Use when setting up, designing, writing, or repairing tests and test harnesses in a Meteor 3 app. Triggers on meteortesting:mocha, --driver-package, TEST_WATCH, TEST_BROWSER_DRIVER, MOCHA_GREP, meteor.testModule, focused tests, .only, Meteor.server.method_handlers, Meteor.server.publish_handlers, DDP.connect, --full-app integration mode, sinon, async test signatures, Playwright/Cypress E2E. Use this skill when the user asks about test runners, asks about testing publications, or asks about Jest vs Mocha in Meteor. For a failing, hanging, or flaky test whose failing layer or root cause is unknown, use meteor-debugging before changing the test or app.

★ 11
meteor
meteor/agent-skills

meteor-security

Use when auditing or hardening a Meteor 3 application. Triggers on missing check() on method arguments, missing this.userId guards on publications, browser-policy CSP, DDPRateLimiter rules, oauth-encryption via Accounts.config oauthSecretKey, audit-argument-checks, allow/deny legacy patterns, BrowserPolicy.content.disallowInlineScripts, BrowserPolicy.framing.disallow. Use this skill when the user asks about hardening, asks about a security review, or asks about CSP for a third-party script (Stripe, Google Maps, fonts).

★ 11
meteor
meteor/agent-skills

meteor-react

Use when building or debugging React interfaces in Meteor 3: meteor create --react, createRoot, JSX or TSX entry points, Rspack React detection, Fast Refresh, react-meteor-data, useTracker, useSubscribe, useFind, withTracker, Suspense, and Tracker.withComputation. Triggers on isLoading being treated as a boolean, useFind receiving fetch(), stale closure inputs, duplicate tracker side effects, unstable Suspense keys, lost reactivity after await, state reset after refresh, or React tests leaking computations. Use this skill when the user asks about a React skeleton, React Compiler, React-specific rspack.config rules, reactive data hooks, or classic versus Suspense integration. Route general bundler configuration to meteor-modern-build-stack and Meteor 2 upgrades to migrate-to-meteor-3.

★ 11