Skip to content
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

Alternative approach to fixing serverless-webpack hot reload integration #1090

Closed
wants to merge 3 commits into from

Conversation

kelchm
Copy link
Contributor

@kelchm kelchm commented Sep 5, 2020

This pull request implements an alternative approach to #1050 for fixing #931. The concept here is fairly simple in that we hook the after:webpack:compile:watch:compile event from serverless-weback in order to trigger a forced cleanup of the Lambda functions.

I've also made a change to the default configuration by setting allowCache: true. This should address a wide range of issues that have been reported recently against the v6.7.0 release, albeit at the expense of hot reload working with the default options.

The overall upside here is that we get all the benefits of the caching behavior (including maintaining out of box compatibility with things like the aws-sdk) while still being able to support hot reloading. In my testing this has been very performant and reliable so far.

Limitations

  • This doesn't solve the problem for anyone who isn't also using serverless-webpack
  • This approach only works with worker threads (useWorkerThreads: true)
  • The tight coupling with events from serverless-webpack isn't very elegant

Additional Issues Addressed

TODO

  • Investigate test failures
  • Update Documentation
  • Unit Tests

- Enable cache by default
- Enable worker threads on node v11.7.0 and higher
@kelchm
Copy link
Contributor Author

kelchm commented Sep 5, 2020

I'm not 100% sure how to address the SyntaxError: Cannot use import statement outside a module error from workerThreadHelper.js. I may have jumped the gun a bit on trying to set useWorkerThreads: true -- would it be best to revert that particular change for now?

@dl748
Copy link
Contributor

dl748 commented Sep 5, 2020

Your build broke several tests. While your fix addresses the issues, it also breaks hot reloading for them as they are not using serverless-webpack.

@kelchm
Copy link
Contributor Author

kelchm commented Sep 5, 2020

Your build broke several tests. While your fix addresses the issues, it also breaks hot reloading for them as they are not using serverless-webpack.

You're right -- I've gone ahead and reverted the change to the default for the useWorkerThreads option as it seems that hasn't previously been exercised in the CI pipeline at all and there are existing issues that would need to be solved to get the tests passing.

@kelchm
Copy link
Contributor Author

kelchm commented Sep 5, 2020

Closing this, as I think the more generic approach in #1093 makes more sense.

@kelchm kelchm closed this Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants