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

Error when using vite with mdx, and navigating from link #8685

Closed
broisnischal opened this issue Feb 5, 2024 · 3 comments
Closed

Error when using vite with mdx, and navigating from link #8685

broisnischal opened this issue Feb 5, 2024 · 3 comments

Comments

@broisnischal
Copy link

Reproduction

create the new remix app, with vite plugin either using the cloudflare or without, and addind the @mdx-js/rollup as the markdown plugin and creating the mdx file, and navigating to that link

System Info

System:
    OS: Linux 6.5 Fedora Linux 37 (Workstation Edition)
    CPU: (16) x64 AMD Ryzen 7 5700G with Radeon Graphics
    Memory: 13.19 GB / 22.85 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.7.0 - /usr/local/bin/pnpm
    bun: 1.0.14 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 121.1.62.153
    Chrome: 121.0.6167.85
  npmPackages:
    @remix-run/cloudflare: ^2.6.0 => 2.6.0 
    @remix-run/cloudflare-pages: ^2.6.0 => 2.6.0 
    @remix-run/dev: ^2.6.0 => 2.6.0 
    @remix-run/react: ^2.6.0 => 2.6.0 
    vite: ^5.0.0 => 5.0.12

Used Package Manager

npm

Expected Behavior

When navigating to another mdx link in that should navigate using the mdx rollup plugin, but getting issue of internal server error,

[vite] Internal server error: Unexpected token (1:0)
  Plugin: remix-route-exports
  File: /home/nees/newproj/app/routes/blog.mdx:1:0
  1  |  # testing

Actual Behavior

should navigate with no error,

@pcattori
Copy link
Contributor

pcattori commented Feb 5, 2024

Can you share your vite.config.ts? My guess is that you have the MDX plugin after the Remix plugin, but MDX transpilation to JS has to happen before Remix takes over. See https://remix.run/docs/en/main/future/vite#add-mdx-plugin.

Also, does this issue only occur if you navigate from a non-MDX page to an MDX page? Or does it also occur if you refresh the page once on the MDX page?

@pcattori
Copy link
Contributor

pcattori commented Feb 7, 2024

We now warn when the MDX plugin comes after the Remix plugin (#8690)

@pcattori
Copy link
Contributor

pcattori commented Feb 9, 2024

Cannot reproduce, so closing this. If you can share a reproduction, we can reopen.

@pcattori pcattori closed this as completed Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants