New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to update schema on Apollo Server using Webpack's Hot Reload? #2481
Comments
Have you read this article (you may need to read this in Incognito Mode)? https://medium.freecodecamp.org/build-an-apollo-graphql-server-with-typescript-and-webpack-hot-module-replacement-hmr-3c339d05184f This worked for me nicely, but you need to have your Webpack process running in one terminal tab and executing the JS code in a secondary terminal tab. |
@DevNebulae I managed to get it running via another way! |
@spyshower For documentation's sake, could you please post your resolution? Don't be like DenverCoder9. |
resolvers.js
typeDefs.js
index.js
The typeDefs/resolvers files are incomplete of course. |
I was searching the same problem and arrived here. After some minutes of researching, reading code, I came up with a cleaner solution:
|
Are you sure about that? Seems overkill |
I think it should be better than calling makeExecutableSchema every request. Here I just do it every time we reload. |
@MartinPham Gonna try that, since my approach doesn't work for |
Let me know :) I was using the latest version btw |
Thanks @MartinPham ! I used your solution but instead of setting the httpServer on the process, I just reloaded if the file where I have the schemas changed.
|
but probably you'd need to reload the resolvers also? |
Yea, sorry, I didn't put all the code in the response but this is what our
We use schema stitching and the allSchemas() function returns a graphQL schema. |
Can you please help? @MartinPham Getting Following:
|
Hi not sure if you are still having issues, but this would of helped me sooner if it was answered.
|
I am a beginning Dev, but advanced sysadmin. I'm using this setup to learn about GQL. I have the app up and running in webpack, But every reload fails on:
My Index.js
My package.json:
I was building this boilerplate for internal user in an application later. But i have an idea. I think a lot of people are looking for an apollo-server that does: HMR Maybe its a good idea to build something like this, Kind of like NextJs for GQL? I am more than willing to contribute, and use it in production / Help out with documentation. I'm even willing to be the Idiot, so we can make it idiot-proof ;) |
On Webpack, I see this:
But nothing is updated. I have tried some other solutions I found online regarding webpack's output.publicPath. I have no idea what else to do and soon I am going to production. Restarting the server is not an option for me.
My code:
I checked out #1275 but found no solution.
The text was updated successfully, but these errors were encountered: