fileURLToPath not found in 'url' webpack 5 #1306
-
im using [email protected] because of hardened requirement of react 18+ on the now when compiling with webpack 5 i see the following error:
i'm aware that webpack5 does not pollyfill node's core libs automatically. why is VFile required in react-markdown? i only see a single usage of it. also, can VFile be build for browser environments only? because browser's url and node's url libs have different APIs all together. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Welcome @nullhook!
Because react-markdown, remark, and unified work on virtual files provided by vfile. |
Beta Was this translation helpful? Give feedback.
-
since im using an older version of react-markdown i also have a slightly older version of the vfile lib. is the below version also browser compataible? edit: yes, it seems so: https://github.com/vfile/vfile/blob/5d3c0de9529e4b0dd45cd7c2d9919b95e169eab9/package.json#L38-L41
|
Beta Was this translation helpful? Give feedback.
-
not sure if webpack 5 respects the "browser" field anymore? but the following worked in webpack config alias: { './minurl.js': path.resolve('./node_modules/vfile/lib/minurl.browser.js'), }, |
Beta Was this translation helpful? Give feedback.
Welcome @nullhook!
Sorry you ran into a spot of trouble.
vFile
provides a browser compatible implementation out of the box https://github.com/vfile/vfile/blob/de87feae24b65cd21975022636b70b0ad7331342/package.json#L36-L50Something in your webpack configuration it telling webpack you aren't running in a browser, but instead are running in node.
Because react-markdown, remark, and unified work on virtual files provided by vfile.
It is used extensively at many levels of the dependency tree.