Skip to content

Commit

Permalink
chore: add option to serveFakeManifest
Browse files Browse the repository at this point in the history
  • Loading branch information
EasonSoong committed Sep 15, 2023
1 parent 2ea85a6 commit 8f0ff0d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/libs/s3-static-assets/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type UploadStaticAssetsOptions = {
credentials: Credentials;
publicDirectoryCache?: PublicDirectoryCache;
abTestPaths?: string[];
serveFakeManifest?: boolean;
};

/**
Expand All @@ -38,7 +39,8 @@ const uploadStaticAssetsFromBuild = async (
credentials,
basePath,
publicDirectoryCache,
nextConfigDir
nextConfigDir,
serveFakeManifest
} = options;
const s3 = await S3ClientFactory({
bucketName,
Expand Down Expand Up @@ -74,7 +76,7 @@ const uploadStaticAssetsFromBuild = async (
.filter(filterOutDirectories)
.map(async (fileItem) => {
console.info("static file path: ", fileItem.path);
if (fileItem.path.endsWith("_buildManifest.js")) {
if (serveFakeManifest && fileItem.path.endsWith("_buildManifest.js")) {
console.info("clear _buildManifest.js");
fse.writeFileSync(fileItem.path, "");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ class NextjsComponent extends Component {
nextStaticDir: nextStaticPath,
credentials: this.context.credentials.aws,
publicDirectoryCache: inputs.publicDirectoryCache,
abTestPaths
abTestPaths,
serveFakeManifest: inputs.serveFakeManifest ?? false
});
} else {
await uploadStaticAssets({
Expand Down
1 change: 1 addition & 0 deletions packages/serverless-components/nextjs-component/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export type ServerlessComponentInputs = {
sentry?: SentryOptions;
abTests?: ABTest[];
enableRemoteInvalidation?: boolean;
serveFakeManifest?: boolean;
};

type CloudfrontOptions = Record<string, any>;
Expand Down

0 comments on commit 8f0ff0d

Please sign in to comment.