Skip to content

Commit 6ee3f61

Browse files
authored
Merge pull request #32306 from storybookjs/valentin/fix-nextjs-webpack-error
Next.js: Fix version mismatch error in Webpack
2 parents b28b1a8 + 6a5b7ea commit 6ee3f61

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

code/frameworks/nextjs/src/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ import { fileURLToPath } from 'node:url';
44

55
import { getProjectRoot } from 'storybook/internal/common';
66

7+
import { WebpackDefinePlugin } from '@storybook/builder-webpack5';
8+
79
import type { NextConfig } from 'next';
810
import { PHASE_DEVELOPMENT_SERVER } from 'next/constants.js';
911
import nextJsLoadConfigModule from 'next/dist/server/config.js';
10-
import webpack from 'webpack';
1112
import type { Configuration as WebpackConfig } from 'webpack';
1213

1314
import { resolvePackageDir } from '../../../core/src/shared/utils/module';
1415

1516
export const configureRuntimeNextjsVersionResolution = (baseConfig: WebpackConfig): void => {
16-
const { DefinePlugin } = webpack;
1717
baseConfig.plugins?.push(
18-
new DefinePlugin({
18+
new WebpackDefinePlugin({
1919
'process.env.__NEXT_VERSION': JSON.stringify(getNextjsVersion()),
2020
})
2121
);

0 commit comments

Comments
 (0)