From 17e2994fcc420f0cda4d74bfeb2ba91e0109d2cd Mon Sep 17 00:00:00 2001 From: jimthedev Date: Thu, 27 Feb 2020 21:04:46 -0600 Subject: [PATCH] fix: noop @prisma/client in browser, closes #13 --- examples/first-demo/next.config.js | 12 +++++++++++- examples/first-demo/noop.js | 0 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 examples/first-demo/noop.js diff --git a/examples/first-demo/next.config.js b/examples/first-demo/next.config.js index 307b1aac55..07945a3751 100644 --- a/examples/first-demo/next.config.js +++ b/examples/first-demo/next.config.js @@ -1,3 +1,13 @@ +const path = require('path') // NOTE: This is ONLY needed in this Blitz monorepo so that package hot reloading works properly const withTM = require('next-transpile-modules')(['@blitzjs/core']) -module.exports = withTM({}) +module.exports = withTM({ + webpack: (config, {buildId, dev, isServer, defaultLoaders, webpack}) => { + if (!isServer) { + // Noop resolution of @prisma/client in the browser + // since setting an alias to false does not work + config.resolve.alias['@prisma/client'] = path.join(__dirname, 'noop.js') + } + return config + }, +}) diff --git a/examples/first-demo/noop.js b/examples/first-demo/noop.js new file mode 100644 index 0000000000..e69de29bb2