模块打包器
概述
¥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.7.0 开始,Prisma ORM 具有 queryCompiler
预览功能。
¥As of v6.7.0, Prisma ORM has the queryCompiler
Preview feature.
启用后,你的 Prisma 客户端将生成 无需基于 Rust 的查询引擎二进制文件:
¥When enabled, your Prisma Client will be generated without a Rust-based query engine binary:
generator client {
provider = "prisma-client-js"
previewFeatures = ["queryCompiler", "driverAdapters"]
}
请注意,驱动适配器 预览功能与 queryCompiler
功能同时启用。使用 queryCompiler
预览功能时,连接池由你正在使用的原生 JS 数据库驱动程序维护。
¥Note that the driver adapters Preview feature is required alongside queryCompiler
. When using the queryCompiler
Preview feature, the connection pool is maintained by the native JS database driver you're using.
为此,你可以使用可复制静态资源的插件:
¥To do so, you can use plugins that let you copy over static assets:
打包器 | 插入 |
---|---|
Webpack | copy-webpack-plugin |
Webpack(带有 Next.js 单一存储库) | nextjs-monorepo-workaround-plugin |
Parcel | parcel-plugin-static-files-copy |