-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
vite fails when cjs module requires a module with "#" in its path #2346
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
Comments
+1 |
check filePath has '?' or '#' does exists: if (postfixIndex > 0 && !fs.existsSync(fsPath.slice(0, postfixIndex+1))) {
file = fsPath.slice(0, postfixIndex)
postfix = fsPath.slice(postfixIndex)
} |
thanks. will try it! |
This issue is impossible to search for because you can't search |
This same issue was encountered in the rollup community
They fixed it by simply not worrying about a hash in the path whatsoever. |
I'm running into this issue as well. Is there a temporary workaround while we wait for the fix to get merged? |
This feature was introduced in Vite 2.0.0 34064c8 It's not clear why this was added. Is there any documentation for what vite does with the hash postfix? |
TIL: Node supports subpath imports and requires that they start with a "#".
This leads to code like this (from the node manual): import '#dep' |
I had the same problem and just wanted to share my workaround. In my export default defineConfig({
plugins: [/* ... */],
resolve: {
alias: {
pagedjs: 'pagedjs/dist/paged.esm.js',
},
}
}) |
@alex3683 seems like a simple solution. will try it. thanks a lot! |
Please report back if it works for you. If so, we can label this issue with |
Yes, it does work. Thank you @alex3683 |
this doesn't work for me with |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
I have a dependency on
pagedjs
which depends ond
which depends ones5-ext/string/#/contains
. insided
module there is actually a require call that I thinks it fails inside vitecontains = require("es5-ext/string/#/contains");
(!!!NOTICE # SIGN INSIDE REQUIRE!!!)Reproduction
System Info
vite
version: 2.0.5Logs (Optional if provided reproduction)
The text was updated successfully, but these errors were encountered: