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

[vite]: Rollup failed to resolve import "#minpath" from "node_modules/vfile/lib/index.js". #864

Closed
4 tasks done
ahmedrowaihi opened this issue Oct 3, 2024 · 5 comments
Closed
4 tasks done
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on

Comments

@ahmedrowaihi
Copy link

Initial checklist

Affected packages and versions

react-markdown@9.0.1, vfile@6.x.x

Link to runnable example

scaffold a react app with vite

Steps to reproduce

  • install react-markdown
  • run the build
  • observe error
[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`
error during build:
Error: [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`

Expected behavior

it should use the minpath.browser, minproc.browser, minurl.browser imports

Actual behavior

it fails to use correct imports

Affected runtime and version

node@v22.3.0, vite@3.x.x

Affected package manager and version

No response

Affected OS and version

No response

Build and bundle tools

Rollup

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Oct 3, 2024
@ahmedrowaihi
Copy link
Author

a temporary fix, is patching the vfile package

diff --git a/node_modules/vfile/lib/index.js b/node_modules/vfile/lib/index.js
index 68db7f9..84cebfd 100644
--- a/node_modules/vfile/lib/index.js
+++ b/node_modules/vfile/lib/index.js
@@ -9,9 +9,9 @@
  */
 
 import {VFileMessage} from 'vfile-message'
-import {minpath} from '#minpath'
-import {minproc} from '#minproc'
-import {urlToPath, isUrl} from '#minurl'
+import {minpath} from './minpath.browser'
+import {minproc} from './minproc.browser'
+import {urlToPath, isUrl} from './minurl.browser'
 
 /**
  * Order of setting (least specific to most), we need this because otherwise

you can use it with patch-package or whatever

@ChristianMurphy
Copy link
Member

ChristianMurphy commented Oct 3, 2024

It's a bug in vite's export resolution.
This was fixed several major versions ago in vite.
Upgrade your vite version.

@ChristianMurphy ChristianMurphy closed this as not planned Won't fix, can't repro, duplicate, stale Oct 3, 2024
@ChristianMurphy ChristianMurphy added the 👀 no/external This makes more sense somewhere else label Oct 3, 2024

This comment has been minimized.

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Oct 3, 2024
@ahmedrowaihi
Copy link
Author

yes, I added it for the community in case someone will hit this issue and have no option to migrate vite

@gabrieljablonski
Copy link

yes, I added it for the community in case someone will hit this issue and have no option to migrate vite

and thanks for that. I'm running v3, and there's no way in hell i'm upgrading my bundler because of 3 lines of code on a dependency of a dependency 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

3 participants