Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 2 additions & 4 deletions bin/packages/build-vendors.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,12 @@ async function bundleReactJsxRuntime() {
async function bundleReactRefresh() {
console.log( '📦 Bundling React Refresh...' );

// Bundle react-refresh-entry
// Bundle react-refresh-entry using react-refresh
const entryDir = path.join( BUILD_DIR, 'react-refresh-entry' );
await mkdir( entryDir, { recursive: true } );

await esbuild.build( {
entryPoints: [
'@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js',
],
entryPoints: [ path.join( __dirname, 'react-refresh-entry.js' ) ],
outfile: path.join( entryDir, 'index.min.js' ),
bundle: true,
format: 'iife',
Expand Down
11 changes: 11 additions & 0 deletions bin/packages/react-refresh-entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* React Refresh Entry
*
* Injects the React Refresh runtime into the global hook for hot module replacement.
*/
import RefreshRuntime from 'react-refresh/runtime';

if ( ! globalThis.__reactRefreshInjected ) {
RefreshRuntime.injectIntoGlobalHook( globalThis );
globalThis.__reactRefreshInjected = true;
}
1 change: 1 addition & 0 deletions bin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"log-performance-results.js",
"packages/build-vendors.mjs",
"packages/build.mjs",
"packages/react-refresh-entry.js",
"packages/check-build-type-declaration-files.js",
"plugin/cli.js",
"plugin/commands/common.js",
Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"@inquirer/prompts": "7.2.0",
"@octokit/rest": "16.26.0",
"@playwright/test": "1.57.0",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
"@storybook/addon-a11y": "10.1.11",
"@storybook/addon-docs": "10.1.11",
"@storybook/icons": "2.0.1",
Expand Down
Loading