-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Failed to load url /node_modules/path-browserify/posix #48
Comments
This relates to #16. I think the best approach here is to use the new |
path-browserify already defaults to the posix implementation and my lib gets bundled for both node (without a polyfill) and web (path-browserify), so I can't change the import to just But the main issue is that there's no way to make vite-plugin-node-polyfills resolve the whole would it be possible to allow overrides like |
Ah, that makes sense. I think |
I've started looking into this, and I found a temporary workaround. Add a custom import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
nodePolyfills(),
],
resolve: {
alias: {
'path/posix': 'path-browserify',
},
},
}) |
That seems to work for the small project I sent earlier but doesn't work for my local one. I also found another workaround: import { posix } from 'path';
const { dirname, join, relative } = posix; |
Bump on this. |
Reproduction: https://stackblitz.com/edit/vitejs-vite-1axycb?file=main.js
Its currently possible to do
import { join } from 'path'
orimport { posix } from 'path'
but not these:Error:
(Not sure if that is the correct repo to report it to or https://github.com/niksy/node-stdlib-browser)
The text was updated successfully, but these errors were encountered: