Skip to content

Commit

Permalink
Merge pull request #23671 from sookmax/nextjs-precompiled-react
Browse files Browse the repository at this point in the history
NextJS: Aliases `react` and `react-dom` like `next.js` does
  • Loading branch information
ndelangen authored Sep 19, 2023
2 parents 48356ea + e00fe77 commit 2b9bf9a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 2 additions & 0 deletions code/frameworks/nextjs/src/config/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const configureConfig = async ({
const nextConfig = await resolveNextConfig({ baseConfig, nextConfigPath, configDir });

addScopedAlias(baseConfig, 'next/config');
addScopedAlias(baseConfig, 'react', 'next/dist/compiled/react');
addScopedAlias(baseConfig, 'react-dom', 'next/dist/compiled/react-dom');
setupRuntimeConfig(baseConfig, nextConfig);

return nextConfig;
Expand Down
11 changes: 1 addition & 10 deletions code/ui/blocks/src/components/Story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ const InlineStory: FunctionComponent<InlineStoryProps> = (props) => {
};
}, [autoplay, renderStoryToElement, story]);

// We do this so React doesn't complain when we replace the span in a secondary render
const htmlContents = `<span></span>`;

if (error) {
return (
<pre>
Expand All @@ -83,13 +80,7 @@ const InlineStory: FunctionComponent<InlineStoryProps> = (props) => {
)} { min-height: ${height}; transform: translateZ(0); overflow: auto }`}</style>
) : null}
{showLoader && <StorySkeleton />}
<div
ref={storyRef}
id={`${storyBlockIdFromId(props)}-inner`}
data-name={story.name}
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: htmlContents }}
/>
<div ref={storyRef} id={`${storyBlockIdFromId(props)}-inner`} data-name={story.name} />
</>
);
};
Expand Down

0 comments on commit 2b9bf9a

Please sign in to comment.