Skip to content

现代构建堆栈

¥Modern Build Stack

Meteor 打包器由几个关键组件组成,这些组件可提升你在开发和部署到生产环境时的体验。这些包括:

¥The Meteor bundler is made up of several key components that enhance your experience both during development and when deploying to production. These include:

  • 转译器:负责将每个文件转换为跨不同浏览器和运行时环境兼容的语法。

    ¥Transpiler: Responsible for converting each file into a syntax compatible across different browsers and runtime environments.

  • 打包器:处理发现应用的文件和依赖,包括 Meteor 软件包和核心模块,然后将它们链接到可用于生产的软件包中。它还应用了优化,以生成更轻量的构建和更快的流程。

    ¥Bundler: Handles discovering your app’s files and dependencies, including Meteor packages and core modules, then links them into production-ready bundles. It also applies optimizations to produce lighter builds and faster processes.

  • 开发服务器:在开发过程中,它会监视文件更改,并通过 HMR、bundle 可视化工具、调试工具等支持快速反馈。在运行时,它提供了一个功能齐全的服务器环境,支持 SSR 和基于 Express 的现代 API。

    ¥Dev Server: During development, it watches for file changes, and supports fast feedback via HMR, bundle visualizers, debug tools, and more. At runtime, it provides a full-featured server environment with support for SSR and modern APIs powered by Express.

为了提升所有 Meteor 项目的开发和部署体验,我们正在改进以下每个组件,重点是提升性能、提供更智能的工具和精简的软件包大小:

¥To improve the development and deployment experience for all Meteor projects, we’re revamping each of these components with a focus on better performance, smarter tooling, and leaner bundle sizes:

  • 现代转译器:Meteor 正在采用 SWC 作为 Babel 的更快替代方案。

    ¥Modern Transpiler: Meteor is adopting SWC as a faster alternative to Babel.

  • 现代打包工具:新的打包器将只处理你应用的代码,支持 tree-shaking、热门插件以及更强大的开发和生产环境功能。同时,Meteor 的核心打包器将继续处理 Meteor 特定的任务,例如编译 Atmosphere 包,并优化工作流程。

    ¥Modern Bundler: A new bundler will handle only your app’s code, supporting tree-shaking, popular plugins, and better features for both development and production. Meanwhile, Meteor’s core bundler will continue handling Meteor-specific tasks, such as compiling Atmosphere packages, with optimized workflows.

  • 现代开发服务器:开发服务器仍然是 Meteor 的核心部分,现在性能和开发者功能不断改进。新的打包程序将补充开发服务器,提供额外的增强功能。

    ¥Modern Dev Server: The dev server remains a core part of Meteor, now with ongoing improvements in performance and developer features. A new bundler will complement the dev server, providing additional enhancements.

快速入门

¥Quick start

通过创建 Meteor 应用开始使用新的构建堆栈,或将其添加到现有 package.json 中:

¥Start using the new build stack by creating a Meteor app, or add this to your package.json in an existing one:

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

使用此配置,你可以在 Meteor 应用中启用现代构建堆栈中的所有改进。

¥With this configuration, you enable all improvements from the modern build stack in your Meteor app.

请参阅以下部分了解每个组件及其设置:

¥See the following sections to learn about each component and its settings: