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

Omitting the process Webpack polyfill can cause issues #689

Open
ericsoco opened this issue Sep 18, 2019 · 5 comments
Open

Omitting the process Webpack polyfill can cause issues #689

ericsoco opened this issue Sep 18, 2019 · 5 comments

Comments

@ericsoco
Copy link

Fusion's Webpack config intentionally omits the process polyfill.

I'm filing this issue not to suggest specific action, but to highlight that this can cause difficult-to-debug issues with libraries that reference process directly in a way that is not e.g. compatible with EnvironmentPlugin (i.e. process.env checks).

Here's an example we ran into with react-markdown, which led us to vfile.

What does Fusion gain by not polyfilling process (which runs contrary to the default in Webpack and also Browserify), other than saving a few bytes in the bundle?

@rtsao
Copy link
Member

rtsao commented Oct 9, 2019

FWIW webpack is removing default polyfilling.

Part of the reasoning was usage of Node built-ins usually indicates a situation where a Node.js dependency was erroneously being bundled. That said, I do think it would be better to include all polyfills by default, but issue warnings if they are ever used.

@ericsoco
Copy link
Author

ericsoco commented Oct 28, 2019

Probably worth adding the config to restore the webpack polyfill in a Fusion app here, for those who need it. Add the following to .fusionrc.js:

  nodeBuiltins: {
    process: true,
  },

@nsepehr
Copy link

nsepehr commented Apr 21, 2020

@ericsoco thanks so much. I was having this issue and couldn't understand what's happening.

@ericsoco
Copy link
Author

ericsoco commented Jul 1, 2020

Here's another one I just came across, in this case requiring:

nodeBuiltins: {
  Buffer: true
}

I suppose the list may go on and on. I hope Webpack does a good job broadcasting the change to remove polyfilling as they roll out v5.

@akshaychauhan7737
Copy link

process is very much important object
facing this issue with request package which is highly used package.
request package is giving error when webpack is moved to webpack5

please either give a way to polyfil process in frontend applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants