Skip to content

Commit 2b9bf9a

Browse files
authored
Merge pull request #23671 from sookmax/nextjs-precompiled-react
NextJS: Aliases `react` and `react-dom` like `next.js` does
2 parents 48356ea + e00fe77 commit 2b9bf9a

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

code/frameworks/nextjs/src/config/webpack.ts

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export const configureConfig = async ({
1717
const nextConfig = await resolveNextConfig({ baseConfig, nextConfigPath, configDir });
1818

1919
addScopedAlias(baseConfig, 'next/config');
20+
addScopedAlias(baseConfig, 'react', 'next/dist/compiled/react');
21+
addScopedAlias(baseConfig, 'react-dom', 'next/dist/compiled/react-dom');
2022
setupRuntimeConfig(baseConfig, nextConfig);
2123

2224
return nextConfig;

code/ui/blocks/src/components/Story.tsx

+1-10
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ const InlineStory: FunctionComponent<InlineStoryProps> = (props) => {
6464
};
6565
}, [autoplay, renderStoryToElement, story]);
6666

67-
// We do this so React doesn't complain when we replace the span in a secondary render
68-
const htmlContents = `<span></span>`;
69-
7067
if (error) {
7168
return (
7269
<pre>
@@ -83,13 +80,7 @@ const InlineStory: FunctionComponent<InlineStoryProps> = (props) => {
8380
)} { min-height: ${height}; transform: translateZ(0); overflow: auto }`}</style>
8481
) : null}
8582
{showLoader && <StorySkeleton />}
86-
<div
87-
ref={storyRef}
88-
id={`${storyBlockIdFromId(props)}-inner`}
89-
data-name={story.name}
90-
// eslint-disable-next-line react/no-danger
91-
dangerouslySetInnerHTML={{ __html: htmlContents }}
92-
/>
83+
<div ref={storyRef} id={`${storyBlockIdFromId(props)}-inner`} data-name={story.name} />
9384
</>
9485
);
9586
};

0 commit comments

Comments
 (0)