hashicorp / next-mdx-remote

Load MDX content from anywhere
Mozilla Public License 2.0
2.67k stars 140 forks source link

Unexpected Token `...` In Production #243

Closed max-pod closed 2 years ago

max-pod commented 2 years ago

Hello, I'm encountering an error in Sentry on static pages with a link to a mdx-rendered page, complaining that ... is an unexpected token. Would appreciate any help!

Error: Raw original/unminified: SyntaxError: Unexpected token ... at ? (../../node_modules/next-mdx-remote/node_modules/@mdx-js/react/lib/index.js:53:43)

Unminified: ` * @param {Record<string, unknown> & {components?: Components}} props

Using:

  1. next-mdx-remote 4.0.0
  2. sentry/nextks ^6.12.0
  3. next 11.1.3

TSConfig:

{ "compilerOptions": { // "incremental": true, "target": "es5", "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "lib": ["es2015", "dom"], "noEmit": true, "jsx": "preserve", "noImplicitAny": true, "alwaysStrict": true, "strictNullChecks": true }, "include": ["src", "pages"], "exclude": ["node_modules", "build", "src/**/*.test.ts", "src/**/*.test.tsx"] }

BRKalow commented 2 years ago

@max-pod Was the error thrown from the server or the browser? If the browser, do you have additional information from sentry on what browser it was?

max-pod commented 2 years ago

Wide spectrum of browsers, multiple users, and client-side.

  1. "Crosswalk 11.45 android 7.1.1"
  2. Chrome
    • Chrome Mobile 42, 43, 50
    • Chrome Dekstop 50, 83, 84, 86, 87 (highest 87)
  3. Firefox 78

Chrome 87 particularly threw me off, since that's not exactly old: 2020-11-17 https://en.wikipedia.org/wiki/Google_Chrome_version_history

Couldn't replicated the error locally, nor through browser stack emulating the same browser versions. I think it's coming from Next's link preloading, but I can't tell.

lachlanjc commented 2 years ago

Also experiencing this! On Safari 10 especially.

BRKalow commented 2 years ago

I'm going to close this for now, please feel free to create another issue or reply here if you're able to dig up more information or a concrete reproduction.

Thanks!