Repository: remix-run/remix
Pull request #1328 (2022-01-03 16:47:28)

chore(remix-server): update Remix App Server log to use local ip 
Signed-off-by: Logan McAnsh <logan@mcan.sh>


Patch:
diff --git a/fixtures/gists-app/app/routes/__layout2.tsx b/fixtures/gists-app/app/routes/__layout2.tsx
new file mode 100644
index 000000000..96e61bf46
--- /dev/null
+++ b/fixtures/gists-app/app/routes/__layout2.tsx
@@ -0,0 +1,10 @@
+import { Outlet } from "remix";
+
+export default function LayoutTest2() {
+  return (
+    <div data-test-id="_layout">
+      <h1>Layout Test 2</h1>
+      <Outlet />
+    </div>
+  );
+}
diff --git a/fixtures/gists-app/app/routes/__layout2/with-layout2.tsx b/fixtures/gists-app/app/routes/__layout2/with-layout2.tsx
new file mode 100644
index 000000000..fa24fc879
--- /dev/null
+++ b/fixtures/gists-app/app/routes/__layout2/with-layout2.tsx
@@ -0,0 +1,7 @@
+export default function WithLayout() {
+  return (
+    <div>
+      <h1>Page inside layout</h1>
+    </div>
+  );
+}
diff --git a/packages/create-remix/templates/arc/package.json b/packages/create-remix/templates/arc/package.json
index 733489f69..9802a7cc3 100644
--- a/packages/create-remix/templates/arc/package.json
+++ b/packages/create-remix/templates/arc/package.json
@@ -6,7 +6,6 @@
     "start": "arc sandbox"
   },
   "dependencies": {
-    "@remix-run/architect": "*",
-    "aws-sdk": "2.796.0"
+    "@remix-run/architect": "*"
   }
 }
diff --git a/packages/create-remix/templates/arc/server/config.arc b/packages/create-remix/templates/arc/server/config.arc
index 38e9ab85d..3d11ce0fc 100644
--- a/packages/create-remix/templates/arc/server/config.arc
+++ b/packages/create-remix/templates/arc/server/config.arc
@@ -1,5 +1,5 @@
 @aws
-# runtime nodejs14.x
+runtime nodejs14.x
 # memory 1152
 # timeout 30
 # concurrency 1
diff --git a/packages/remix-dev/cli/commands.ts b/packages/remix-dev/cli/commands.ts
index c49a7cd00..77ec24161 100644
--- a/packages/remix-dev/cli/commands.ts
+++ b/packages/remix-dev/cli/commands.ts
@@ -1,4 +1,5 @@
 import * as path from "path";
+import os from "os";
 import * as fse from "fs-extra";
 import exitHook from "exit-hook";
 import prettyMs from "pretty-ms";
@@ -169,8 +170,16 @@ export async function dev(remixRoot: string, modeArg?: string) {
   try {
     await watch(config, mode, {
       onInitialBuild: () => {
+        let address = Object.values(os.networkInterfaces())
+          .flat()
+          .find(ip => ip?.family == "IPv4" && !ip.internal)?.address;
+
+        if (!address) {
+          throw new Error("Could not find an IPv4 address.");
+        }
+
         server = app.listen(port, () => {
-          console.log(`Remix App Server started at http://localhost:${port}`);
+          console.log(`Remix App Server started at http://${address}:${port}`);
         });
       }
     });
diff --git a/packages/remix-dev/config/routesConvention.ts b/packages/remix-dev/config/routesConvention.ts
index b096a4093..2ff0143af 100644
--- a/packages/remix-dev/config/routesConvention.ts
+++ b/packages/remix-dev/config/routesConvention.ts
@@ -70,7 +70,7 @@ export function defineConventionalRoutes(
       let fullPath = createRoutePath(routeId.slice("routes".length + 1));
       let uniqueRouteId = (fullPath || "") + (isIndexRoute ? "?index" : "");
 
-      if (typeof uniqueRouteId !== "undefined") {
+      if (uniqueRouteId) {
         if (uniqueRoutes.has(uniqueRouteId)) {
           throw new Error(
             `Path ${JSON.stringify(fullPath)} defined by route ${JSON.stringify(
diff --git a/packages/remix-react/components.tsx b/packages/remix-react/components.tsx
index 3c5f96839..36dd4ae95 100644
--- a/packages/remix-react/components.tsx
+++ b/packages/remix-react/components.tsx
@@ -1182,10 +1182,13 @@ export function useMatches() {
   return matches.map(match => {
     let { pathname, params } = match;
     return {
+      id: match.route.id,
       pathname,
       params,
       data: routeData[match.route.id],
-      handle: routeModules[match.route.id].handle
+      // if the module fails to load or an error/response is thrown, the module
+      // won't be defined.
+      handle: routeModules[match.route.id]?.handle
     };
   });
 }
diff --git a/packages/remix-serve/cli.ts b/packages/remix-serve/cli.ts
index 4cae3a74c..fbf07c1a1 100644
--- a/packages/remix-serve/cli.ts
+++ b/packages/remix-serve/cli.ts
@@ -1,5 +1,6 @@
 import "./env";
 import path from "path";
+import os from "os";
 
 import { createApp } from "./index";
 
@@ -15,5 +16,13 @@ if (!buildPathArg) {
 let buildPath = path.resolve(process.cwd(), buildPathArg);
 
 createApp(buildPath).listen(port, () => {
-  console.log(`Remix App Server started at http://localhost:${port}`);
+  let address = Object.values(os.networkInterfaces())
+    .flat()
+    .find(ip => ip?.family == "IPv4" && !ip.internal)?.address;
+
+  if (!address) {
+    throw new Error("Could not find an IPv4 address.");
+  }
+
+  console.log(`Remix App Server started at http://${address}:${port}`);
 });


Test patch:
diff --git a/packages/remix-dev/__tests__/readConfig-test.ts b/packages/remix-dev/__tests__/readConfig-test.ts
index dad28fe42..0081ebb8a 100644
--- a/packages/remix-dev/__tests__/readConfig-test.ts
+++ b/packages/remix-dev/__tests__/readConfig-test.ts
@@ -86,6 +86,22 @@ describe("readConfig", () => {
             "parentId": "routes/__layout",
             "path": "with-layout",
           },
+          "routes/__layout2": Object {
+            "caseSensitive": undefined,
+            "file": "routes/__layout2.tsx",
+            "id": "routes/__layout2",
+            "index": undefined,
+            "parentId": "root",
+            "path": undefined,
+          },
+          "routes/__layout2/with-layout2": Object {
+            "caseSensitive": undefined,
+            "file": "routes/__layout2/with-layout2.tsx",
+            "id": "routes/__layout2/with-layout2",
+            "index": undefined,
+            "parentId": "routes/__layout2",
+            "path": "with-layout2",
+          },
           "routes/action-catches": Object {
             "caseSensitive": undefined,
             "file": "routes/action-catches.jsx",