Skip to content

Bundler

Meteor 负责将所有项目文件链接到最终的软件包中。同时,我们仍然专注于尽快保留 Meteor 上下文中剩余的内容。

¥Meteor handles linking all project files into the final bundle. While we'd like to offload more of this to a modern bundler, we're still focused on keeping what's left in the Meteor context as fast as possible.

Meteor 3.4 正在与现代打包工具集成。同时,我们优化了现有流程以提高性能。

¥Integration with a modern bundler is in progress for Meteor 3.4. Meanwhile, we've optimized existing processes for better performance.

Web Arch

信息

从 Meteor 3.3 开始

¥Starting with Meteor 3.3

Web 架构是 Meteor 为现代浏览器、旧版浏览器和 Cordova 生成的构建版本。

¥Web archs are the builds Meteor generates for modern browsers, legacy browsers, and Cordova.

新应用在开发模式下默认跳过 web.browser.legacyweb.cordova(除非是原生开发)。这将在开发模式下获得更快的构建过程。

¥New apps skip web.browser.legacy and web.cordova by default in development mode (unless developing for native). This results on getting a faster build process on development mode.

对于现有应用,请通过添加到 package.json 来启用此功能:

¥For existing apps, enable this by adding to package.json:

json
"meteor": {
  "modern": true
}

这就像将 --exclude-archs web.browser.legacy,web.cordovameteor run 结合使用一样。

¥This works like using --exclude-archs web.browser.legacy,web.cordova with meteor run.

默认情况下,"modern": true 启用所有构建堆栈升级。要退出仅限 Web 架构的编译,请在你的 package.json 中设置 "webArchOnly": false

¥By default, "modern": true enables all build stack upgrades. To opt out of web arch-only compilation, set "webArchOnly": false in your package.json.

json
"meteor": {
  "modern": {
    "webArchOnly": false
  }
}

此设置不影响生产环境;Meteor 应用仍然默认包含旧版构建。

¥This setting doesn’t affect production; legacy builds are still included by default on Meteor apps.

要在生产环境中排除旧版本构建,请将 "modern" 添加到 .meteor/platforms 文件中。

¥To exclude legacy builds in production, add "modern" to the .meteor/platforms file.

sh
server
browser
modern

压缩器

¥Minifier

信息

从 Meteor 3.3 开始

¥Starting with Meteor 3.3

压缩器会压缩并混淆应用的生产包,以确保安全性和效率。

¥The minifier reduces and obfuscates your app’s production bundle for security and efficiency.

新应用使用基于 SWC 的压缩器,取代了旧版 Terser 压缩器。这加快了生产构建和部署的速度。

¥New apps use an SWC-based minifier, replacing the legacy Terser minifier. This speeds up production builds and deployments.

对于现有应用,请通过添加到 package.json 来启用此功能:

¥For existing apps, enable this by adding to package.json:

json
"meteor": {
  "modern": true
}

默认情况下,"modern": true 启用所有构建堆栈升级。要退出新的压缩器,请在你的 package.json 中设置 "minifier": false

¥By default, "modern": true enables all build stack upgrades. To opt out of the new minifier, set "minifier": false in your package.json.

json
"meteor": {
  "modern": {
    "minifier": false
  }
}