Skip to main content

模块打包器

概述

¥Overview

模块打包器将 JavaScript 模块打包到单个 JavaScript 文件中。大多数打包器的工作原理是将 JavaScript 代码从各种源文件复制到目标文件中。

¥Module bundlers bundle JavaScript modules into a single JavaScript file. Most bundlers work by copying over the JavaScript code from a variety of source files into the target file.

由于 Prisma Client 不仅基于 JavaScript 代码,而且还依赖于 查询引擎二进制文件 的可用,因此你需要确保打包的代码可以访问二进制文件。

¥Since Prisma Client is not only based on JavaScript code, but also relies on the query engine binary file to be available, you need to make sure that your bundled code has access to the binary file.

注意

v6.16.0 开始,Prisma ORM 可以在生产应用中不使用 Rust 引擎使用。了解更多 此处

¥As of v6.16.0, Prisma ORM can be used without Rust engines in production applications. Learn more here.

启用后,你的 Prisma 客户端将不包含基于 Rust 的查询引擎二进制文件:

¥When enabled, your Prisma Client will be generated without a Rust-based query engine binary:

generator client {
provider = "prisma-client-js" // or "prisma-client"
output = "../src/generated/prisma"
engineType = "client" // no Rust engine
}

请注意,如果你想在不使用 Rust 引擎的情况下使用 Prisma ORM,则需要 驱动适配器

¥Note that driver adapters are required if you want to use Prisma ORM without Rust engines.

你可以在我们的博客上了解此更改。

¥You can read about the performance and DX improvements of this change on our blog.

为此,你可以使用可复制静态资源的插件:

¥To do so, you can use plugins that let you copy over static assets: