Skip to content

Commit

Permalink
fix(nextjs): set --experimental-build-mode correctly for convert-to-i…
Browse files Browse the repository at this point in the history
…nferred
  • Loading branch information
jaysoo committed Jun 27, 2024
1 parent 4197a91 commit 7eaffad
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,10 @@ describe('convert-to-inferred', () => {
{},
{
build: {
debug: true,
profile: true,
experimentalAppOnly: true,
experimentalBuildMode: true,
experimentalBuildMode: 'generate',
},
}
);
Expand All @@ -393,7 +395,12 @@ describe('convert-to-inferred', () => {
const projectConfig = readProjectConfiguration(tree, project.name);
expect(projectConfig.targets.build).toMatchObject({
options: {
args: ['--experimental-app-only', '--experimental-build-mode'],
args: [
'--debug',
'--profile',
'--experimental-app-only',
'--experimental-build-mode generate',
],
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,36 @@ function handlePropertiesFromTargetOptions(
delete options.watch;
}

if ('experimentalAppOnly' in options && options.experimentalAppOnly) {
options['args'] ??= [];
options['args'].push('--experimental-app-only');
if ('debug' in options) {
if (options.debug) {
options['args'] ??= [];
options['args'].push('--debug');
}
delete options.debug;
}

if ('profile' in options) {
if (options.profile) {
options['args'] ??= [];
options['args'].push('--profile');
}
delete options.profile;
}

if ('experimentalAppOnly' in options) {
if (options.experimentalAppOnly) {
options['args'] ??= [];
options['args'].push('--experimental-app-only');
}
delete options.experimentalAppOnly;
}

if ('experimentalBuildMode' in options && options.experimentalBuildMode) {
if ('experimentalBuildMode' in options) {
options['args'] ??= [];
options['args'].push(`--experimental-build-mode`);
options['args'].push(
`--experimental-build-mode ${options.experimentalBuildMode}`
);
delete options.experimentalBuildMode;
}

configValues[configuration] = configMap;
}

0 comments on commit 7eaffad

Please sign in to comment.