Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Improve TypeScript support of Next.js examples #18088

Merged
merged 2 commits into from
Oct 29, 2019
Merged

[docs] Improve TypeScript support of Next.js examples #18088

merged 2 commits into from
Oct 29, 2019

Conversation

Tokenyet
Copy link
Contributor

@Tokenyet Tokenyet commented Oct 29, 2019

Fix Typescript error for

Closes #18044

@mui-pr-bot
Copy link

mui-pr-bot commented Oct 29, 2019

No bundle size changes comparing e693f95...cd2198a

Generated by 🚫 dangerJS against cd2198a

@oliviertassinari oliviertassinari added docs Improvements or additions to the documentation typescript labels Oct 29, 2019
@oliviertassinari
Copy link
Member

I confirm it works with amp, but I had to do these changes:

diff --git a/examples/nextjs-with-typescript/pages/_document.tsx b/examples/nextjs-with-typescript/pages/_document.tsx
index 05473eab3..4ac67ac2f 100644
--- a/examples/nextjs-with-typescript/pages/_document.tsx
+++ b/examples/nextjs-with-typescript/pages/_document.tsx
@@ -6,13 +6,9 @@ import theme from '../src/theme';
 export default class MyDocument extends Document {
   render() {
     return (
-      <html lang="en">
+      <html lang="en" amp="true">
         <Head>
           <meta charSet="utf-8" />
-          <meta
-            name="viewport"
-            content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no"
-          />
           {/* PWA primary color */}
           <meta name="theme-color" content={theme.palette.primary.main} />
           <link
diff --git a/examples/nextjs-with-typescript/pages/index.tsx b/examples/nextjs-with-typescript/pages/index.tsx
index f8993c3dc..fb5cdb933 100644
--- a/examples/nextjs-with-typescript/pages/index.tsx
+++ b/examples/nextjs-with-typescript/pages/index.tsx
@@ -6,6 +6,8 @@ import MuiLink from '@material-ui/core/Link';
 import ProTip from '../src/ProTip';
 import Link from '../src/Link';

+export const config = { amp: true };
+
 function Copyright() {
   return (
     <Typography variant="body2" color="textSecondary" align="center">

@oliviertassinari oliviertassinari changed the title [docs] Apply changes as suggested in issue #18044 [docs] Improve TypeScript support of Next.js examples Oct 29, 2019
@oliviertassinari
Copy link
Member

@Tokenyet Thank you

@mufaddal7
Copy link

@oliviertassinari still facing the same issue when using materialui in AMP pages in nextjs.

image

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 22, 2021

@mufaddal7 Maybe we broke it again, no idea. The support of AMP isn't a priority, could you look into what's wrong and fix it :)? (For v5)

@mufaddal7
Copy link

Sure, I can do that. Can you give me a head start or a guide on how you had fixed it last time? @oliviertassinari

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 22, 2021

@mufaddal7 This pull request is about fixing AMP, it's all the information we have (I believe)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nextjs-with-typescript build
4 participants