Comments (14)
cc @fastify/typescript
from fastify-nextjs.
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.
from fastify-nextjs.
I have no idea how to fix this bug and after more research it looks like that behavior comes from the nextjs implementation... Should I open a ticket on their side, find a way to block the behavior on fastify nextjs or make the tsconfig setting works globally with thoses settings for fastify ?
from fastify-nextjs.
I believe it is a non-issue here. Next.js planned to modify the user setting, but it already provided the information that modified.
It doesn't means that the current template
is in-compatible to this plugin but it requires you to justify yourself is the modification fit your needs.
from fastify-nextjs.
I not pretty sure I get what you mean, it's not a modifications that I ask it just don't work the way I showed in the description ^^'
from fastify-nextjs.
it just don't work the way I showed in the description
Then, a proper repro with all the code would be great.
from fastify-nextjs.
I'm running into the same problem. I created a typescript project with fastify generate . --lang=ts
and tried to include @fastify/nextjs
. I managed to get things to build but I can't get the nextjs pages to server via fastify.
A more robust demo repo of how to setup this up with the default typescript fastify project would be really helpful.
from fastify-nextjs.
Also, one maybe helpful clarification.
I modified by build step to be :
"build": "tsc && next build",
With this change npm run start
works correctly. npm run dev
does not, it goes into an infinite loop with loading environment variables.
from fastify-nextjs.
I put together a demo repository that demonstrates this problem: https://github.com/fozziethebeat/fastify-nextjs-ts.
I created this by running
npx fastify generate fastify-nextjs-ts --lang=ts
cd fastify-next-ts
npm install
npm i @fastify/nextjs next react react-dom
And then adding a basic src/pages/hello.tsx
and updating src/app.ts
with the lines recommended in the primary README.
I can confirm that npm run start
works properly and includes the nextjs page. Running npm run dev
goes into an infinite loop where the server never starts.
from fastify-nextjs.
To try and diagnose this further, I did the same steps but with the standard javascript Fastify template project. I stored that in this repo: https://github.com/fozziethebeat/fastify-nextjs-js
With the javascript template, npm run dev
also hangs forever and never starts the server. It doesn't output anything so I can't quite tell what's going on. But I'm guessing fastify -w
is what's triggering some underlying issue.
from fastify-nextjs.
fastify-cli
is watching the CWD
.
If something is triggering the changes
, it is expected to restart forever.
I assume nextjs
is actually always built the temp assets inside node_modules
in dev
mode.
And when it restart, the dev
mode will clear the temp assets and rebuild again.
That's also why pre-built would works.
Maybe adding node_modules
inside the ignore list would helps.
from fastify-nextjs.
I think that's the part I wasn't too familiar with (Still getting familiar with fastify).
Replacing the typescript dev:start
command to be
"dev:start": "fastify start --ignore-watch='node_modules .next .ts$' -w -l info -P dist/app.js"
did the trick. now npm run dev
is working and picking up all the changes. I also had to set noEmit
to false in tsconfig.
from fastify-nextjs.
I am going to close and pin this issue.
The solution already exists throughout the conversation.
from fastify-nextjs.
I updated my test typescript repo with the changes and things are now working smoothly for me. I'll freeze this demo repo so others that run into this problem can replicate the changes.
from fastify-nextjs.
Related Issues (20)
- Update to latest Next.js HOT 18
- Update to Fastify v4 HOT 6
- Would be interested in seeing some sort of benchmarks (@fastify/nextjs) HOT 5
- fastify.next() is not a function HOT 5
- Remove package-lock, 2nd try
- Getting FastifyDeprecation: Modifying the "reply.sent" property is deprecated. Use the "reply.hijack()" method instead. HOT 2
- There is no host in the middleware of nextjs HOT 1
- Can you add an example for Assets serving in the readme ? HOT 7
- Next JS Api Routes - POST - Invalid Body response with request body payload HOT 4
- nextjs plugin trying to get /_next/webpack-hmr and has no current response HOT 1
- Fastify inject method instead of fetch or axios HOT 2
- Does the fastify-nextjs public folder not work as designed by NextJS? HOT 3
- fastify.inject timeout when @fastify/nextjs is registered HOT 4
- Throw error when use with [email protected] HOT 1
- drop node 14 support?! HOT 6
- How to implement ssr cache in next.js 13 HOT 1
- In Jest tests, when closing fastify/nextjs (app.close()), nextjs does not close
- fastify-nextjs with app router in next.js HOT 1
- Support Next.js v14 HOT 3
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 fastify-nextjs.