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

Is it possible to hot-reload template.yaml? #21

Closed
vadzim opened this issue Dec 14, 2019 · 5 comments
Closed

Is it possible to hot-reload template.yaml? #21

vadzim opened this issue Dec 14, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@vadzim
Copy link
Contributor

vadzim commented Dec 14, 2019

Hot reloading source files with aws-sam-webpack-plugin is such a wonderfull and convenient thing that it's hard to remember why things stopped to work after adding another lambda to template.yaml :)

So the question is is it really possible to hot-reload template.yaml when it's been changed?

@buggy buggy added the enhancement New feature or request label Dec 14, 2019
@buggy
Copy link
Collaborator

buggy commented Dec 26, 2019

You might be able to use nodemon to restart webpack but I can't see another solution. The only time the entry points can be set in the webpack.config.js is when webpack loads it. If they provide another way to set them then I'm happy to revisit this request.

@buggy buggy closed this as completed Dec 26, 2019
@buggy
Copy link
Collaborator

buggy commented Dec 26, 2019

After re-reading the Webpack docs I'm going to change the recommended webpack.config.js from entry: awsSamPlugin.entry() to entry: () => awsSamPlugin.entry() which will cause it to reload the entry points each time it builds. It will still only build once a source file is changed (not template.yaml) but you'll always be building from the most recently saved template.yaml.

@vadzim
Copy link
Contributor Author

vadzim commented Dec 26, 2019

Wow. I missed that entry-function feature in webpack. Thanks.

Yeah, I'm already using nodemon.

I know that webpack plugins can add dependencies to watch into webpack while building projects.
May be awsSamPlugin could do that for template.yaml?
Then it wouldn't need to use nodemon.
This will allow to escape repeating file names and is gonna be less error-prone.

@vadzim
Copy link
Contributor Author

vadzim commented Dec 26, 2019

P.S. There is also one trick, if awsSamPlugin.entry is not a method of a class, but just a field with a function, then it can be used like entry: awsSamPlugin.entry, without brackets.

@buggy
Copy link
Collaborator

buggy commented Dec 26, 2019

I'm not planning to add further support for hot reloading based on the template.yaml changing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants