-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix: clear redirects/rewrites produced by previous builds and generate functions in ntl dev #738
Conversation
✅ Deploy Preview for netlify-plugin-gatsby-demo-v5 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for netlify-plugin-gatsby-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
constants, | ||
}: NetlifyPluginOptions): Promise<void> { | ||
// eslint-disable-next-line no-param-reassign | ||
netlifyConfig.build.environment.GATSBY_PRECOMPILE_DEVELOP_FUNCTIONS = `true` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gatsby compiles functions lazily in dev (waiting for /api/X
to be requested before function is compiled) by default which cause problems if we want to wrap them - this will force compile them eagerly
contents: neededFunctions.includes('API') | ||
? '/api/* /.netlify/functions/__api 200' | ||
: '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this now always handles redirects - if API is "not needed" - it will clean up dangling redirect
Summary
Reverts #724 + adds fixes needed:
ntl dev
clears.netlify/functions-internal
so we have to (re)generate them. Alternatively we could skip that and rely on gatsby dev server handling functions however this movesntl dev
further away from builds (+ there is some quirk with with CLI where*/x-www-form-urlencoded
andmultipart/form-data
requests are not proxied to dev server at least currently).This also clears out redirects produced by
gatsby-plugin-netlify
ANDgatsby-adapter-netlify
if builld happened before - those redirects would be for DSG/SSR functions that can't work in dev, because gatsby doesn't even produce engines in dev and DSG/SSR pages are handled just the same as SSG pages in devTest plan
Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal
FRA-181
Standard checks:
🧪 Once merged, make sure to update the version if needed and that it was
published correctly.