You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the ReactMarkdown component is wrapped in a new class. and this class is imported by React.lazy method.
src/render_md.tsx
import * as React from 'react'
import ReactMarkdown from 'react-markdown'
export class RenderMarkdown extends React.Component<{}, {}> {
render() {
return (
<div
style={{
height: 300,
overflowY: 'scroll',
}}
>
<ReactMarkdown>
{"# title"}
</ReactMarkdown>
</div>
)
}
}
export default RenderMarkdown
App.tsx
import * as React from 'react'
function App() {
const DynamicComponent = React.lazy(() => import("@/render_md"))
return (
<React.Suspense fallback={<div>loading component</div>}>
<DynamicComponent />
</React.Suspense>
)
}
export default App
Expected behavior
no extra config in vite.config.ts
Actual behavior
[vite]: Rollup failed to resolve import "#minpath" from "node_modules/vfile/lib/index.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
After adding external: ['vfile'] in vite.config.ts, the yarn-build problem is gone but another error appears in the chrome:
Uncaught TypeError: Failed to resolve module specifier "vfile". Relative references must start with either "/", "./", or "../".
Runtime
Node v16
Package manager
yarn 1
OS
Linux
Build and bundle tools
Vite
The text was updated successfully, but these errors were encountered:
Initial checklist
Affected packages and versions
"react-markdown": "^9.0.1"
Link to runnable example
No response
Steps to reproduce
package.json
react
the
ReactMarkdown
component is wrapped in a new class. and this class is imported byReact.lazy
method.src/render_md.tsx
App.tsx
Expected behavior
no extra config in vite.config.ts
Actual behavior
After adding
external: ['vfile']
invite.config.ts
, theyarn-build
problem is gone but another error appears in the chrome:Runtime
Node v16
Package manager
yarn 1
OS
Linux
Build and bundle tools
Vite
The text was updated successfully, but these errors were encountered: