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

process.cwd is not a function #492

Closed
MichaelKheel opened this issue Oct 20, 2020 · 1 comment
Closed

process.cwd is not a function #492

MichaelKheel opened this issue Oct 20, 2020 · 1 comment
Labels
👯 no/duplicate Déjà vu 🙋 no/question This does not need any changes

Comments

@MichaelKheel
Copy link

Hello, after switching to webpack 5, I just can't get this module to work, I tried everything possible, added polyfills to the webpack settings, added the module require('process') to the /core.js . Tell me how you can get it to work at least temporarily?

Uncaught TypeError: process.cwd is not a function
    at new VFile (vendors-node_modules_material-ui_icons_esm_EventAvailable_js-node_modules_material-ui_icons_e-69977d.bundle.3539fc11cce8d41811bd.js:10184)
    at VFile (vendors-node_modules_material-ui_icons_esm_EventAvailable_js-node_modules_material-ui_icons_e-69977d.bundle.3539fc11cce8d41811bd.js:10178)
    at Function.parse (vendors-node_modules_material-ui_icons_esm_EventAvailable_js-node_modules_material-ui_icons_e-69977d.bundle.3539fc11cce8d41811bd.js:9384)
    at ReactMarkdown (vendors-node_modules_material-ui_icons_esm_EventAvailable_js-node_modules_material-ui_icons_e-69977d.bundle.3539fc11cce8d41811bd.js:8500)
    at renderWithHooks (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:79814)
    at mountIndeterminateComponent (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:82493)
    at beginWork (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:83607)
    at HTMLUnknownElement.callCallback (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:65199)
    at Object.invokeGuardedCallbackDev (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:65248)
    at invokeGuardedCallback (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:65303)
    at beginWork$1 (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:88214)
    at performUnitOfWork (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:87165)
    at workLoopSync (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:87141)
    at performSyncWorkOnRoot (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:86767)
    at vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:76100
    at unstable_runWithPriority (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:104976)
    at runWithPriority$1 (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:76050)
    at flushSyncCallbackQueueImpl (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:76095)
    at flushSyncCallbackQueue (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:76083)
    at scheduleUpdateOnFiber (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:86210)
    at dispatchAction (vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-c70d23.bundle.15c7cbcdd7af9de1ef55.js:80671)
    at src_pages_releases_jsx.bundle.5da1a3c4fe86fc0c934a.js:102

image

@MichaelKheel MichaelKheel added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Oct 20, 2020
@ChristianMurphy
Copy link
Member

ChristianMurphy commented Oct 20, 2020

This is a duplicate of #339
see #339 (comment) for the solution


Also for questions please use https://github.com/remarkjs/remark/discussions
and for bug reports, do not clear the report template, fill it out.

@ChristianMurphy ChristianMurphy added 👯 no/duplicate Déjà vu 🙋 no/question This does not need any changes and removed 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Oct 20, 2020
wooorm added a commit to vfile/vfile that referenced this issue Dec 6, 2020
Many new developers do not know how to configure webpack.
When they use a package that somewhere deep down uses `path` or `process` or
whatnot, through webpack 5, they mistakingly think this package does not work in
browsers.

This infuriating mistake by webpack leads to superfluous work for maintainers
and bigger bundles for users because polyfills add bloat.

See:
* <https://blog.sindresorhus.com/webpack-5-headache-b6ac24973bf1>
* <vercel/next.js#16022>

Note that this change shaves off 40% from the bundle size compared to including
`path` and `process`, however, it will double the bundlephobia size (because it
normally does not include path/process) and will hurt folks who depend on
another project that includes `path`.

Related to #16.
Related to #28.
Related to #38.
Related to #35.
Related to #56.
Related to #57.
Related to #58.
Related to remarkjs/react-markdown#492.
Related to remarkjs/react-markdown#514.

Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👯 no/duplicate Déjà vu 🙋 no/question This does not need any changes
Development

No branches or pull requests

2 participants