blitz-js / legacy-framework

MIT License
2 stars 2 forks source link

Unable to build MDX pages on Vercel – `Error: found pages without a React Component as default export in` #996

Closed alfonmga closed 2 years ago

alfonmga commented 2 years ago

What is the problem?

Blitz.js is unable to build MDX pages when is being build on Vercel. Another affected user posted this issue on StackOverflow. with more information.

Paste all your error logs here:

Error: Build optimization failed: found pages without a React Component as default export in
See https://nextjs.org/docs/messages/page-without-valid-component for more info.

Paste all relevant code snippets here:

// blitz.config.ts
import { BlitzConfig } from "blitz"

const config: BlitzConfig = {
  pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
}

const withMDX = require("@next/mdx")({
  extension: /\.mdx?$/,
  options: {
    remarkPlugins: [],
    rehypePlugins: [[imageSize, { dir: "public" }]],
    providerImportSource: "@mdx-js/react",
  },
})

module.exports = withMDX(config)

What are detailed steps to reproduce this?

  1. blitz new myAppName
  2. Follow the instructions at https://nextjs.org/docs/advanced-features/using-mdx#setup-nextmdx-in-nextjs to setup MDX
  3. Create new file at app/pages/about.mdx
  4. Try to build the app on Vercel vercel build

Run blitz -v and paste the output here:

macOS Big Sur | darwin-x64 | Node: v16.16.0

blitz: 0.45.4 (local)

  Package manager: yarn
  System:
    OS: macOS 11.6.5
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 1.54 GB / 16.00 GB
    Shell: 3.5.0 - /usr/local/bin/fish
  Binaries:
    Node: 16.16.0 - /var/folders/qg/r5kp591d2dd_brtfzrn6l6z80000gn/T/yarn--1659553043567-0.3809742674829155/node
    Yarn: 1.22.18 - /var/folders/qg/r5kp591d2dd_brtfzrn6l6z80000gn/T/yarn--1659553043567-0.3809742674829155/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
    Watchman: Not Found
  npmPackages:
    @prisma/client: Not Found
    blitz: 0.45.4 => 0.45.4
    prisma: Not Found
    react: 18.0.0 => 18.0.0
    react-dom: 18.0.0 => 18.0.0
    typescript: ~4.5 => 4.5.5

Please include below any other applicable logs and screenshots that show your problem:

No response

alfonmga commented 2 years ago

Closing this issue as I decided to move my project off Blitz.js to connect.build.