@remix-run/node
此软件包包含 Node.js 的实用程序和 polyfill。
¥This package contains utilities and polyfills for Node.js.
由于 Remix 依赖于 fetch
等浏览器 API,而这些 API 在 Node.js 中尚未原生稳定地提供,你可能会发现在使用 Jest 等工具运行时,如果没有这些全局变量,单元测试就会失败。
¥Since Remix relies on browser APIs such as fetch
that aren't natively and stably available yet in Node.js you may find that your unit tests fail without these globals when running with tools such as Jest.
你的测试框架应为你提供一个钩子或位置来填充全局变量/模拟 API;你可以在此处添加以下几行来安装 Remix 所依赖的全局变量:
¥Your testing framework should provide you with a hook or location to polyfill globals / mock out APIs; here you can add the following lines to install the globals that Remix relies on:
import { installGlobals } from "@remix-run/node";
// This installs globals such as "fetch", "Response", "Request" and "Headers".
installGlobals();
¥Version Support
Remix 在任何时间点都正式支持活动和维护 Node LTS 版本。Remix Minor 版本将不再支持已停产的 Node 版本。
¥Remix officially supports Active and Maintenance Node LTS versions at any given point in time. Dropped support for End of Life Node versions is done in a Remix Minor release.