From 51892ebbfd1c31f36edd6d09b1385a52c84b0aa3 Mon Sep 17 00:00:00 2001 From: Hemanshu Upadhyay Date: Thu, 8 Aug 2024 23:58:03 +0530 Subject: [PATCH] Migrated 'with-absolute-imports' to App-router Convention (#68666) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hey There 👋 This PR Includes the following changes -> Migration of with-absolute-imports example to App Router -> Updated all packages -> Added the Layout page as per App router Convention. cc - @samcx Co-authored-by: Sam Ko --- examples/with-absolute-imports/app/layout.tsx | 16 ++++++++++++++++ .../{pages/index.tsx => app/page.tsx} | 0 examples/with-absolute-imports/package.json | 12 ++++++------ examples/with-absolute-imports/tsconfig.json | 9 +++++++-- 4 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 examples/with-absolute-imports/app/layout.tsx rename examples/with-absolute-imports/{pages/index.tsx => app/page.tsx} (100%) diff --git a/examples/with-absolute-imports/app/layout.tsx b/examples/with-absolute-imports/app/layout.tsx new file mode 100644 index 0000000000000..5ff842ef07b83 --- /dev/null +++ b/examples/with-absolute-imports/app/layout.tsx @@ -0,0 +1,16 @@ +export const metadata = { + title: "Next.js", + description: "Generated by Next.js", +}; + +export default function RootLayout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + + {children} + + ); +} diff --git a/examples/with-absolute-imports/pages/index.tsx b/examples/with-absolute-imports/app/page.tsx similarity index 100% rename from examples/with-absolute-imports/pages/index.tsx rename to examples/with-absolute-imports/app/page.tsx diff --git a/examples/with-absolute-imports/package.json b/examples/with-absolute-imports/package.json index 1412a9c80e177..73d5d82d6d127 100644 --- a/examples/with-absolute-imports/package.json +++ b/examples/with-absolute-imports/package.json @@ -7,13 +7,13 @@ }, "dependencies": { "next": "latest", - "react": "^18.2.0", - "react-dom": "^18.2.0" + "react": "^18.3.1", + "react-dom": "^18.3.1" }, "devDependencies": { - "@types/node": "^18.11.9", - "@types/react": "^18.0.25", - "@types/react-dom": "^18.0.8", - "typescript": "^4.8.4" + "@types/node": "^22.1.0", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "typescript": "^5.5.4" } } diff --git a/examples/with-absolute-imports/tsconfig.json b/examples/with-absolute-imports/tsconfig.json index e4af555219514..6fbdd052312c3 100644 --- a/examples/with-absolute-imports/tsconfig.json +++ b/examples/with-absolute-imports/tsconfig.json @@ -19,8 +19,13 @@ // Using "paths" allows you to configure module path aliases "paths": { "@/components/*": ["components/*"] - } + }, + "plugins": [ + { + "name": "next" + } + ] }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "exclude": ["node_modules"] }