From 5a14306f7bbe8756474690b2015902525d4b7779 Mon Sep 17 00:00:00 2001 From: Siddharth Suresh Date: Thu, 9 May 2024 19:35:23 +0530 Subject: [PATCH] regression: export `enhancePrisma` from the brower (#4326) * move it back to index-server * fix turbopack * Create big-cars-raise.md * cleanup * fix * fix lint --- .changeset/big-cars-raise.md | 7 +++++++ packages/blitz-next/scripts/postinstall.js | 5 +++++ packages/blitz-next/scripts/turbopack-empty.js | 1 + packages/blitz-rpc/src/index-server.ts | 7 ++++--- packages/blitz/src/index-browser.tsx | 1 + packages/blitz/src/index-server.ts | 1 - 6 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 .changeset/big-cars-raise.md create mode 100644 packages/blitz-next/scripts/turbopack-empty.js diff --git a/.changeset/big-cars-raise.md b/.changeset/big-cars-raise.md new file mode 100644 index 0000000000..50e416049f --- /dev/null +++ b/.changeset/big-cars-raise.md @@ -0,0 +1,7 @@ +--- +"@blitzjs/next": patch +"@blitzjs/rpc": patch +"blitz": patch +--- + +fix export `enhancePrisma` in client diff --git a/packages/blitz-next/scripts/postinstall.js b/packages/blitz-next/scripts/postinstall.js index 3f12289d2c..2659e84b82 100644 --- a/packages/blitz-next/scripts/postinstall.js +++ b/packages/blitz-next/scripts/postinstall.js @@ -170,6 +170,7 @@ function codegen() { const defaultIndexJsPath = path.join(dotBlitzDir, "index.js") const defaultIndexBrowserJSPath = path.join(dotBlitzDir, "index-browser.js") const defaultIndexDTSPath = path.join(dotBlitzDir, "index.d.ts") + const emptyJSPath = path.join(dotBlitzDir, "turbopack-empty.js") if (!fs.existsSync(defaultIndexJsPath)) { await copyFile(path.join(__dirname, "default-index.js"), defaultIndexJsPath) @@ -181,6 +182,10 @@ function codegen() { if (!fs.existsSync(defaultIndexDTSPath)) { await copyFile(path.join(__dirname, "default-index.d.ts"), defaultIndexDTSPath) } + + if (!fs.existsSync(emptyJSPath)) { + await copyFile(path.join(__dirname, "turbopack-empty.js"), emptyJSPath) + } } catch (e) { console.error(e) } diff --git a/packages/blitz-next/scripts/turbopack-empty.js b/packages/blitz-next/scripts/turbopack-empty.js new file mode 100644 index 0000000000..336ce12bb9 --- /dev/null +++ b/packages/blitz-next/scripts/turbopack-empty.js @@ -0,0 +1 @@ +export {} diff --git a/packages/blitz-rpc/src/index-server.ts b/packages/blitz-rpc/src/index-server.ts index e09e8e991b..3412ef5416 100644 --- a/packages/blitz-rpc/src/index-server.ts +++ b/packages/blitz-rpc/src/index-server.ts @@ -160,9 +160,10 @@ export function installWebpackConfig({ export function installTurboConfig() { return { resolveAlias: { - "cross-spawn": {browser: "./turbopack/empty.js"}, - "npm-which": {browser: "./turbopack/empty.js"}, - fs: {browser: "./turbopack/empty.js"}, + "cross-spawn": {browser: ".blitz/turbopack-empty.js"}, + "npm-which": {browser: ".blitz/turbopack-empty.js"}, + fs: {browser: ".blitz/turbopack-empty.js"}, + child_process: {browser: ".blitz/turbopack-empty.js"}, }, rules: { "**/*...blitz*.{jsx,tsx,js,ts}": { diff --git a/packages/blitz/src/index-browser.tsx b/packages/blitz/src/index-browser.tsx index 2213e3ae00..6037d5e6fc 100644 --- a/packages/blitz/src/index-browser.tsx +++ b/packages/blitz/src/index-browser.tsx @@ -19,6 +19,7 @@ export { RedirectError, OAuthError, } +export * from "./utils/enhance-prisma" export type BlitzProviderComponentType = ( component: ComponentType, diff --git a/packages/blitz/src/index-server.ts b/packages/blitz/src/index-server.ts index 5f2d2af110..1f4db65750 100644 --- a/packages/blitz/src/index-server.ts +++ b/packages/blitz/src/index-server.ts @@ -13,7 +13,6 @@ export {reduceBlitzServerPlugins} from "./plugin" export {findNodeModulesRoot, findNodeModulesRootSync} from "./cli/utils/find-node-modules" export {startWatcher, stopWatcher} from "./cli/utils/routes-manifest" -export * from "./utils/enhance-prisma" export interface MiddlewareResponse extends ServerResponse { blitzCtx: C