Skip to content

Commit

Permalink
fix(dev): only do hmr for unstable_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
pcattori committed Feb 9, 2023
1 parent 9fad1ad commit d7e9b60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/remix-dev/compiler/compileBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const createEsbuildConfig = (
NodeModulesPolyfillPlugin(),
].filter(isNotNull);

if (mode === "development") {
if (mode === "development" && config.future.unstable_dev) {
// TODO do this for all deps in package.json
entryPoints["react"] = "react";
entryPoints["react-dom"] = "react-dom";
Expand Down Expand Up @@ -301,7 +301,7 @@ export const createBrowserCompiler = (
]);

let hmr: AssetsManifest["hmr"] | undefined = undefined;
if (options.mode === "development") {
if (options.mode === "development" && remixConfig.future.unstable_dev) {
let hmrRuntimeOutput = Object.entries(metafile.outputs).find(
([_, output]) => output.inputs["hmr-runtime:remix:hmr"]
)?.[0];
Expand Down
20 changes: 11 additions & 9 deletions packages/remix-dev/compiler/plugins/browserRouteModulesPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@ export function browserRouteModulesPlugin(

let contents = removeServerExports(sourceCode, routeFile, onLoader);

contents = await applyHMR(
contents,
{
...args,
path: routeFile,
},
config,
!!build.initialOptions.sourcemap
);
if (config.future.unstable_dev) {
contents = await applyHMR(
contents,
{
...args,
path: routeFile,
},
config,
!!build.initialOptions.sourcemap
);
}

return {
contents,
Expand Down

0 comments on commit d7e9b60

Please sign in to comment.