Skip to content

Commit

Permalink
Patch @remix-run/dev to allow watching changes on packages
Browse files Browse the repository at this point in the history
The solution is here:
remix-run/remix#1193 (comment)
And for patching a npm package is this package:
https://www.npmjs.com/package/patch-package

Which doesn'r work with pnpm LOL. Patched itself here:
ds300/patch-package#302 (comment)
  • Loading branch information
andresgutgon committed Mar 7, 2022
1 parent ec1608f commit 013b0e5
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@babel/core": "^7.17.5",
"@babel/preset-env": "^7.16.11",
"@changesets/cli": "^2.19.0",
"@milahu/patch-package-with-pnpm-support": "^6.4.8",
"@nrwl/cli": "latest",
"@nrwl/remix": "^13.7.1",
"@nrwl/tao": "latest",
Expand Down
50 changes: 50 additions & 0 deletions patches/@remix-run+dev+^1.2.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# generated by patch-package 6.4.8 on 2022-03-07 16:06:40
#
# command:
# npx patch-package @remix-run/dev
#
# declared package:
# @remix-run/dev: ^1.2.3
#
diff --git a/node_modules/@remix-run/dev/compiler.js b/node_modules/@remix-run/dev/compiler.js
index 9bbf9b1..e976656 100644
--- a/node_modules/@remix-run/dev/compiler.js
+++ b/node_modules/@remix-run/dev/compiler.js
@@ -204,6 +204,10 @@ async function watch(config$1, {
}, 100);
let toWatch = [config$1.appDirectory];

+ if (config$1.watchGlobs) {
+ toWatch = toWatch.concat(config$1.watchGlobs);
+ }
+
if (config$1.serverEntryPoint) {
toWatch.push(config$1.serverEntryPoint);
}
diff --git a/node_modules/@remix-run/dev/config.d.ts b/node_modules/@remix-run/dev/config.d.ts
index df065bd..76a4a2d 100644
--- a/node_modules/@remix-run/dev/config.d.ts
+++ b/node_modules/@remix-run/dev/config.d.ts
@@ -108,6 +108,10 @@ export interface AppConfig {
* in a CJS build.
*/
serverDependenciesToBundle?: Array<string | RegExp>;
+ /**
+ * An array of paths to watch for changes.
+ */
+ watchGlobs?: string[];
}
/**
* Fully resolved configuration object we use throughout Remix.
diff --git a/node_modules/@remix-run/dev/config.js b/node_modules/@remix-run/dev/config.js
index 6d76739..abc0b5b 100644
--- a/node_modules/@remix-run/dev/config.js
+++ b/node_modules/@remix-run/dev/config.js
@@ -197,6 +197,7 @@ async function readConfig(remixRoot, serverMode = serverModes.ServerMode.Product
serverBuildTargetEntryModule,
serverEntryPoint: customServerEntryPoint,
serverDependenciesToBundle,
+ watchGlobs: appConfig.watchGlobs || [],
mdx
};
}
94 changes: 91 additions & 3 deletions pnpm-lock.yaml

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

0 comments on commit 013b0e5

Please sign in to comment.