fix(module-federation): do not cache assets from static serve (#27005)

We're currently caching files for an hour when serving the host with
static remotes. This PR fixes the issue by setting `cacheSeconds: -1` on
the static server (disables cache).

This affects development only.
<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
This commit is contained in:
Jack Hsu 2024-07-19 10:39:32 -04:00 committed by GitHub
parent 83b88a10c7
commit 8b1c78caa5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 0 deletions

View File

@ -56,6 +56,7 @@ export function startStaticRemotesFileServer(
ssl: options.ssl,
sslCert: options.sslCert,
sslKey: options.sslKey,
cacheSeconds: -1,
},
context
);

View File

@ -56,6 +56,7 @@ export async function* moduleFederationDevServerExecutor(
spa: false,
withDeps: false,
cors: true,
cacheSeconds: -1,
},
context
)

View File

@ -107,6 +107,7 @@ function startStaticRemotesFileServer(
ssl: options.ssl,
sslCert: options.sslCert,
sslKey: options.sslKey,
cacheSeconds: -1,
},
context
);
@ -267,6 +268,7 @@ export default async function* moduleFederationDevServer(
withDeps: false,
spa: false,
cors: true,
cacheSeconds: -1,
},
context
)