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
watch with serverless offline #566
Comments
I've been having trouble with this too. I use nodemon as a workaround. Here are the scripts:
|
This used to work for me, but after updating my package version it stopped working. |
webpack used to watch and rebuild automatically? |
Serverless offline with serverless-webpack did have the watch thing work, yeah |
Do you know which version broke watch? |
|
facing the same issue. Using nodemon as a workaround works fine. But it is not as fast as serverless-webpack |
Published a little module that I was using internally to solve this, since asking the original question - https://www.npmjs.com/package/serverless-offline-multi but would be great to work out how/when the webpack watch broke |
Also wondering how to do this |
webpack-watch is fixed by this: working on macOS Catalina. custom:
serverless-offline:
useChildProcesses: true |
@AshUK @haroonKhan-10p Worth noting that these are not fixes, more so workarounds. They massively degrade performance, especially for larger projects. |
@haroonKhan-10p that unfortunately didn't do anything for me. The issue for me is that webpack does watch and transpile correctly, but serverless offline uses cached files and not the new ones. I think the issue lies with the I think we will have to dig into the plugin and see if there's some way to fix it. I looked into it yesterday and I don't really see the problem, but I'll keep digging. Also see this related issue: dherault/serverless-offline#931 And this one: dherault/serverless-offline#864 |
|
https://github.com/dherault/serverless-offline/releases/tag/v9.0.0 from serverless-offline v 9.0.0 hard reloading is not supported by default. To support hot reloading, you have to use the below flag
|
This is happening for me too. Modifying files does not trigger a rebuild. Running
I tried EDIT: The issue turned out to be that our bundles were too big. We were in the process of moving to a monorepo and If anyone else runs into this issue, adding this to externals: [
nodeExternals(),
// we need another nodeExternals for the root-level node_modules since
// that's where most of our externals will be
nodeExternals({
modulesDir: path.resolve(__dirname, "path/to/root/node_modules"),
}),
], |
According to the documentation
This has the side effect to adds delays between each requests. |
I solved it by adding this to my serverless.yml
and running
Packages:
|
Feel free to use this plugin to only reload after a webpack compilation. https://www.npmjs.com/package/serverless-webpack-offline-reload |
@thetrevdev if this is working solution maybe this can be directly integrated into serverless-webpack (with condition about enable it or not depending if serverless-offline is part of the project)? WDYT? |
It looks like webpack watch is only initiated from serverless-offline. I see no issue with directly integrating this. It would just be an update to a single line of code. I'll leave the plugin as a stop gap and maybe someone wants to champion a PR with the single line of code below. https://github.com/serverless-heaven/serverless-webpack/blob/master/index.js#L224
|
This is a Question
Description
When using this plugin with Serverless offline, it transpiles as expected but is it possible to trigger a retranspile when a change is detected? Currently have to restart the serverless offline wrapper.
Thanks!
The text was updated successfully, but these errors were encountered: