Closed thescientist13 closed 1 year ago
Bug
While editing an API route and changing its contents works, if there is a module loaded in that API route that gets changed, the contents won't change.
https://user-images.githubusercontent.com/895923/235518201-bac16056-f156-4a62-88c7-70451d60191c.mov
This seems to be an ESM related caching issue, similar to the one we ran into when implementing the same feature for SSR pages, since we are using import programmatically for API routes too
import
async serve(url, request) { const api = this.compilation.manifest.apis.get(url.pathname); const apiUrl = new URL(`.${api.path}`, this.compilation.context.userWorkspace); // https://github.com/nodejs/node/issues/49442 const href = process.env.__GWD_COMMAND__ === 'develop' // eslint-disable-line no-underscore-dangle ? `${apiUrl.href}?t=${Date.now()}` : apiUrl.href; const { handler } = await import(href); const req = new Request(new URL(`${request.url.origin}${url}`), { ...request });
It seems like we'll have to do some sort of Workers related work around here as well, at least until a more robust ESM cache busting solution is available in NodeJS.
Type of Change
Bug
Summary
While editing an API route and changing its contents works, if there is a module loaded in that API route that gets changed, the contents won't change.
https://user-images.githubusercontent.com/895923/235518201-bac16056-f156-4a62-88c7-70451d60191c.mov
Details
This seems to be an ESM related caching issue, similar to the one we ran into when implementing the same feature for SSR pages, since we are using
import
programmatically for API routes tooIt seems like we'll have to do some sort of Workers related work around here as well, at least until a more robust ESM cache busting solution is available in NodeJS.