From f3e5bb764323ea80303d4e4903934e749f6659e1 Mon Sep 17 00:00:00 2001 From: Eric Burel Date: Thu, 6 May 2021 19:04:22 +0200 Subject: [PATCH] Fix rewrite shape in Storybook (#24827) This fixes a bug in `@next/plugin-storybook` caused by an update in the rewrite structure, solution was provided by @stefanprobst https://github.com/vercel/next.js/issues/19345#issuecomment-818856655 Secondary question: it would be awesome if someone at Next could help translating `preset.js` into TypeScript, this would catch those bugs immediately. I've tried in https://github.com/vercel/next.js/pull/18367 but failed to build correctly. ## Bug - [X] Related issues linked using `fixes #number` => parent issue is an umbrella of various small issues: https://github.com/vercel/next.js/issues/19345 - [X] Integration tests added => reproduction is implemented in https://github.com/lbke/next-plugin-storybook-demo until the package is more stable --- packages/next-plugin-storybook/preset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next-plugin-storybook/preset.js b/packages/next-plugin-storybook/preset.js index 372fa9b341bec..9f737d3a29ce9 100644 --- a/packages/next-plugin-storybook/preset.js +++ b/packages/next-plugin-storybook/preset.js @@ -15,7 +15,7 @@ async function webpackFinal(config) { target: 'server', config: nextConfig, buildId: 'storybook', - rewrites: [], + rewrites: { beforeFiles: [], afterFiles: [], fallback: [] }, }) config.plugins = [...config.plugins, ...nextWebpackConfig.plugins]