-
-
Notifications
You must be signed in to change notification settings - Fork 676
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
Hot module reloading with Webpack #289
Comments
I think it's not possible for now - see more in #234.
I would like to know too 😄 |
That hint was good enough to push me in the right direction. I currently ditched the all-Webpack approach to reload the compiled I can import any file and it will be compiled to a JavaScript-compatible module. This goes for CSS, YAML configuration, Handlebar templates, et cetera. Not saying the tool needs to compatible to support those, but a better compatibility with Webpack (hot reloading) would be nice. |
@DevNebulae hi there. Can I take a look at your webpack config? I have troubles with type-graphql. I created the most basic example with webpack and after building it I have my type destroyed: But when I build with tsc -b everything is fine: So when I create additional resolvers I get buildSchema errors and my guess is it's because of the omitted types. I don't need HMR, just bundling, that's why I am asking. Latest versions of all packages.
|
I had the same issue as you were having (never bothered to run the production build yet). What happens is that Webpack in production mode mangles the class and functions names. Meaning that they are shortened to a single letter. In my case, this lead to naming conflicts. I would recommend reading this: https://webpack.js.org/plugins/terser-webpack-plugin/. |
You were right, thanks for your help! |
Hi @DevNebulae, I had the same issue with the hot reload and maybe the solution that I found is suitable for your case. Take a look to this repo Typegraphql Hot Reload. Any constructive feedback is welcome. Regards. |
@ddialar In which part it is hot reload? It just restart the whole node server on |
Hi @19majkel94, maybe we don't understand the same by hot-reload but in my repo's code, with webpack running, if I open the recipe-type.ts file and I comment the description field, after saving the file, the server is reloaded, that's true, but the schema.graphql file is also updated. The same way, if I uncomment the field and save again, after rebooting the field appears in the schema again. That is what I understand as hot-reloading and at least for me, that is enought in order to make easier the development process. Regards. |
It's full reload, with creating DB connection again, etc. In frontend world:
|
OK. I understand. Thank you so much for share your point of view with me. I match with your point of view if we talk about frontend, but I have a new question: if the schema is generated before the server start-up and someone wants to change the types definition, it's imperative to stop the server, compile the new structure and restart the server with the new schema definition, doesn't it? If this hypotesis is right, any change in the types definition couldn't be compiled and accepted by the server on the fly. What do you think? |
I have webpack.common.js
webpack.development.js
webpack.production.js
index.js
Hope this helps! |
As #234 is now solved, this issue should be fixed too 🎉 Please install |
The development mode webpack with hot reloading is working, but is failing with production mode. Can you tell me what are the versions of webpack used to test this? |
Describe the issue
Currently, the library provides no documentation on how to implement hot module reloading in combination with Webpack. Is it even possible? If so, how can one achieve this?
Are you able to make a PR that fix this?
At the moment, just looking for a hotfix.
index.ts
Result
Every time I reload a type, the module throws this error:
The text was updated successfully, but these errors were encountered: