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

[BUG] TypeError: path.dirname is not a function #25

Open
ClintH opened this issue Nov 8, 2022 · 10 comments
Open

[BUG] TypeError: path.dirname is not a function #25

ClintH opened this issue Nov 8, 2022 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@ClintH
Copy link

ClintH commented Nov 8, 2022

I'm also having the error as #9, 'path.dirname is not a function'. I have tried importing from 'monaco-editor-auto-typings/custom-editor' and passing in a monaco instance.

I am using Lit, TS & Vite and the latest version of monaco-editor-auto-typings.

Uncaught (in promise) TypeError: path.dirname is not a function
at AutoTypingsCore2. (chunk-D6HROQ3V.js?v=c1a822df:1459:94)
at step (chunk-D6HROQ3V.js?v=c1a822df:1308:23)
at Object.next (chunk-D6HROQ3V.js?v=c1a822df:1255:18)
at chunk-D6HROQ3V.js?v=c1a822df:1241:71
at new Promise ()
at __awaiter (chunk-D6HROQ3V.js?v=c1a822df:1223:14)
at AutoTypingsCore2.resolveContents (chunk-D6HROQ3V.js?v=c1a822df:1442:16)
at new AutoTypingsCore2 (chunk-D6HROQ3V.js?v=c1a822df:1353:14)
at Function. (chunk-D6HROQ3V.js?v=c1a822df:1370:24)
at step (chunk-D6HROQ3V.js?v=c1a822df:1308:23)

Here's a minimal repro

I am not savvy when it comes to build processes, so maybe there is a Vite/Rollup setting I'm missing.

Any tips appreciated! :)

@ClintH ClintH added the bug Something isn't working label Nov 8, 2022
@burtek
Copy link

burtek commented Nov 8, 2022

Honestly, not seeing that issue happen in the given repro. It seems to be working fine for me.

@ClintH
Copy link
Author

ClintH commented Nov 8, 2022

Thanks for taking a look! You don't see the error in the DevTools console? I see it using Edge & Chrome browsers.

@ClintH
Copy link
Author

ClintH commented Nov 8, 2022

Screen Shot 2022-11-08 at 17 14 33

@burtek
Copy link

burtek commented Nov 8, 2022

Yeah, see it now. Had some wrong filters set in devtools console 🤦

@miraries
Copy link

miraries commented Jun 1, 2023

Just ran into this, I'm using vite as well (with svelte kit).
This works fine in the demo due to path-browserify, so fixed it by adding a similar polyfill for the path module using an esbuild plugin from this gist.

@valerii15298
Copy link

Same problem for me :(
Will be support for vite added???
Would be very much helpful...

@valerii15298
Copy link

@miraries can you please share what exactly and how did you use from that gist? I am looking into it but there are so much stuff that I cannot understand what I should take from it...

@miraries
Copy link

@valerii15298 Do npm i @esbuild-plugins/node-modules-polyfill, then add the following resolve config in your vite.config.js :

export default defineConfig({
  resolve: {
    alias: {
      path: 'rollup-plugin-node-polyfills/polyfills/path'
    }
  }
});

this just adds a polyfill for the path module.

@valerii15298
Copy link

@miraries thank you very much!!!

@valerii15298
Copy link

@miraries btw, I made it work by installing only npm i rollup-plugin-node-polyfills and it seems to work too without @esbuild-plugins/node-modules-polyfill package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants