Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next.js: Fix webpack fsCache not working #29654

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions code/frameworks/nextjs/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ export const addons: PresetProperty<'addons'> = [
export const core: PresetProperty<'core'> = async (config, options) => {
const framework = await options.presets.apply('framework');

// Load the Next.js configuration before we need it in webpackFinal (below).
// This gives Next.js an opportunity to override some of webpack's internals
// (see next/dist/server/config-utils.js) before @storybook/builder-webpack5
// starts to use it. Without this, webpack's file system cache (fsCache: true)
// does not work.
const { nextConfigPath } = await options.presets.apply<FrameworkOptions>('frameworkOptions');
await configureConfig({
// Pass in a dummy webpack config object for now, since we don't want to
// modify the real one yet. We pass in the real one in webpackFinal.
baseConfig: {},
nextConfigPath,
});
valentinpalkovic marked this conversation as resolved.
Show resolved Hide resolved

return {
...config,
builder: {
Expand Down
Loading