Skip to content

Commit 73e26b3

Browse files
Add conditional resolution of webpack version in Next.js projects
1 parent 706f18f commit 73e26b3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

scripts/tasks/sandbox-parts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const install: Task['run'] = async ({ sandboxDir, key }, { link, dryRun,
9595
// We need to add package resolutions to ensure that we only ever install the latest version
9696
// of any storybook packages as verdaccio is not able to both proxy to npm and publish over
9797
// the top. In theory this could mask issues where different versions cause problems.
98-
await addPackageResolutions({ cwd, dryRun, debug });
98+
await addPackageResolutions({ cwd, dryRun, debug, key });
9999
await configureYarn2ForVerdaccio({ cwd, dryRun, debug, key });
100100

101101
// Add vite plugin workarounds for frameworks that need it

scripts/utils/yarn.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ export type YarnOptions = {
1717

1818
const logger = console;
1919

20-
export const addPackageResolutions = async ({ cwd, dryRun }: YarnOptions) => {
20+
export const addPackageResolutions = async ({
21+
cwd,
22+
dryRun,
23+
key,
24+
}: YarnOptions & { key: TemplateKey }) => {
2125
logger.info(`🔢 Adding package resolutions:`);
2226

2327
if (dryRun) {
@@ -35,6 +39,14 @@ export const addPackageResolutions = async ({ cwd, dryRun }: YarnOptions) => {
3539
'playwright-core': '1.48.1',
3640
'@playwright/test': '1.48.1',
3741
};
42+
43+
if (key.includes('nextjs')) {
44+
packageJson.resolutions = {
45+
...packageJson.resolutions,
46+
webpack: '5.98.0',
47+
};
48+
}
49+
3850
await writeJSON(packageJsonPath, packageJson, { spaces: 2 });
3951
};
4052

0 commit comments

Comments
 (0)