Comments (16)
I will upgrade it in a week. @yunsii
from vite-plugin-react-pages.
@yunsii The latest version supports Vite3. You can try it!
from vite-plugin-react-pages.
Thanks. I also plan to upgrade mdx dependencies to its 2.x version. I will take a look into into vite-plugin-mdx today (maybe create an issue in that repo to discuess with the author).
from vite-plugin-react-pages.
Thanks, how about vite-plugin-mdx?
I will send a PR to vite-plugin-mdx, once I find out a way to support nodejs esm without breaking change and test it out.
from vite-plugin-react-pages.
I just published an alpha version that support esm: [email protected]
You can try it out! @yunsii
I will publish it as public version after writing some tests.
Here is an example for ES Module setup:
https://stackblitz.com/edit/vitejs-vite-plugin-react-pages-bhmjv8?file=vite.config.ts&terminal=dev
// vite.config.ts
import { defineConfig } from 'vite'
import * as path from 'path'
import react from '@vitejs/plugin-react'
import pages from 'vite-plugin-react-pages'
// vite-plugin-mdx currently have interop issue in node esm.
// This is a workaround.
// I will send a PR to fix it so users won't need this workaround.
import _mdx from 'vite-plugin-mdx'
const mdx = ((_mdx as any).default || _mdx) as typeof _mdx
export default defineConfig({
plugins: [
react(),
mdx(),
pages({
pagesDir: path.join(__dirname, 'pages'),
}),
],
})
from vite-plugin-react-pages.
Maybe waiting for vite support vitejs/vite#6623 or downgrade @mdx-js/mdx to v1?
@yunsii You need to downgrade @mdx-js/mdx to v1 (because vite-plugin-mdx don't support mdx v2 currently). And use the alpha version vite-plugin-react-pages, like the above example.
from vite-plugin-react-pages.
#68 is merged and published as [email protected]. It supports Node.js esm.
Here is an example for Node.js esm setup:
https://stackblitz.com/edit/vitejs-vite-plugin-react-pages-bhmjv8?file=vite.config.ts&terminal=dev
I have created another issue to track mdx migration: #69
So that we don't make this issue to be too complicated.
from vite-plugin-react-pages.
Hi, I'm using vite v3 currently, and want to use storybook-like tool for now. So any progress? or anything I can help?
from vite-plugin-react-pages.
"@vitejs/plugin-react": "^2.0.1",
"vite": "^3.0.7",
"vite-plugin-react-pages": "^3.2.1",
"vite-pages-theme-doc": "^3.3.0",
from vite-plugin-react-pages.
Great, I will try it later.
from vite-plugin-react-pages.
@csr632 I encounter the same issue like vitejs/vite#5694 So the bundle result should update?
from vite-plugin-react-pages.
@yunsii Are you using nodejs's native ESModule (type: module
in package.json)? I will take a look in this case today.
from vite-plugin-react-pages.
Yes, I use type: module
in package.json, and vite-plugin-mdx
has the same error, this repo LOOKING FOR A NEW MAINTAINER, maybe you can do it? Out of curiosity, I alse have a plan to maintain the repo 🤔
from vite-plugin-react-pages.
For users using nodejs's native ESModule (type: module in package.json), you can workaround vite plugins that not support ESModule currently like this:
import _mdx from 'vite-plugin-mdx'
import _pages from 'vite-plugin-react-pages'
const mdx = (_mdx as any).default as typeof _mdx
const pages = (_pages as any).default as typeof _pages
// mdx and pages will be the actual default export
I will fix vite-plugin-react-pages
soon.
from vite-plugin-react-pages.
Thanks, how about vite-plugin-mdx?
from vite-plugin-react-pages.
Maybe waiting for vite support vite.config.mts
or downgrade @mdx-js/mdx
to v1?
from vite-plugin-react-pages.
Related Issues (20)
- How to add CodeSandbox to a demo block HOT 1
- Error: "The MDX plugin should be placed before this plugin" HOT 1
- Can the default theme adopt vitepress? HOT 1
- Pages generated from src can not access directly HOT 5
- Action Required: Fix Renovate Configuration
- how to kebabCase page url HOT 15
- Excessive indentation in generated source code when using tabs for indentation
- Incorrect image width in markdown content
- Style conflict with antd
- Render demo support show related files
- 想要配置一个不带左侧导航的首页可以实现吗 HOT 1
- Custom remark & rehype plugins for markdown? HOT 5
- node.js dependencies crashing app - fs.realpathSync HOT 1
- Can't get route / pages to work in Build HOT 5
- Doesn't work with @vitejs/plugin-react-swc, redeclaration of const RefreshRuntime HOT 2
- Support Vite 5? HOT 2
- The right anchor disappeared on some pages. HOT 2
- Bug: hmr cause runtime error when add/delete title HOT 1
- Include in an existing project HOT 1
- Files in page folders gets excluded from navigation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-react-pages.