Comments (10)
If we can get away with only modifying watched files in webpack then that would be simpler as to be reactive we would want to setup something that looks like a "next manager" to listen for a specific event and restart the server.
from blitz.
Hey @tconroy, I haven't added next-prisma-plugin
yet because it's still experimental from prisma and I don't know if it works with webpack 5. Also it doesn't it with our globalThis
caching which we still do inside enhancePrisma
.
So need to test that prisma plugin with webpack 5 plus change it to work with globalThis
.
from blitz.
if we can either find a JS tool similar to entr or leverage nodemon
somehow it should be pretty easy to restart the sevrer there. Or maybe even reuse some logic from the synchronizer to detect changes? @ryardley thoughts?
from blitz.
So just reading this I would say the issue is that because prisma generates new types etc. and they aren't loaded into next. Perhaps we can flag certain file changes (prisma.schema
perhaps?) as tabling a restart of next?
from blitz.
I suspect this is because prisma client is inside node_modules and Next doesn't expect files in there to change.
Maybe we only need to modify the webpack config?
from blitz.
Related blitz-js/legacy-framework#466
from blitz.
Is there a solution?
from blitz.
@clearink I think the original issue might be fixed. But regardless, I'm sure there's a way to fix it. No-one has had time to dig into it yet, but anyone is welcome to do so!
Our current new app template has this in db/index.ts
let prisma: PrismaClient
if (process.env.NODE_ENV === "production") {
prisma = new PrismaClient()
} else {
// Ensure the prisma instance is re-used during hot-reloading
// Otherwise, a new client will be created on every reload
global["prisma"] = global["prisma"] || new PrismaClient()
prisma = global["prisma"]
}
export default prisma
That is so that we don't run out of too many db connections during hot code reloading in dev. But I think that also may prevent reloading the schema without a restart.
Could you try removing that and see if a restart if still needed for schema changes?
from blitz.
Solution is to add https://github.com/williamluke4/next-prisma-plugin to our withBlitz
webpack wrapper and to remove the globalThis
stuff from the new app template.
from blitz.
Hey @flybayer 👋 it seems the globalThis
stuff has been removed from the app template since this ticket was originally opened. Does that mean the only remaining step is to add the next-prisma-plugin
to withBlitz
? Have a branch locally with that change, happy to push it up. :-)
from blitz.
Related Issues (20)
- can't locally silence [blitz-rpc] debug logs HOT 1
- deploy failed on vercel HOT 15
- Cannot find module 'next/dist/client/resolve-href' HOT 1
- BLITZ_PUBLIC_ prefix does not expose env to client HOT 2
- BlitzRoutes: Support app router HOT 4
- Windows Compatibility Issue: process.kill("SIGABRT") not supported HOT 5
- useAuthenticatedBlitzContext fails on vercel HOT 7
- getBlitzContext unusable in api HOT 2
- getBlitzContext() can't be use in edge funcion HOT 2
- nextjs (app router) fails on vercel HOT 1
- v2.0.7 `pnpm blitz dev --turbo` error with Invalid next.config.js options HOT 2
- enhancePrisma has disappeared since v2.0.7
- No matching version found for @blitzjs/[email protected] HOT 1
- useAuthenticatedBlitzContext doesn not populate next url param on redirect (app router)
- Allow override of "target" for ES2016+ features in Custom Server HOT 1
- ensure every page has `export const metadata`
- codemod at least has a typo, and maybe other problems HOT 4
- formik added when i pick final-form
- Blitz Auth: Blitz CTX session not populated in api route called from Next.js middleware
- When I use a client component in root layout the server returns a 500 error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blitz.