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

Fixing require to be ignored by Webpack #2115

Merged
merged 2 commits into from
Apr 29, 2020

Conversation

Pauan
Copy link
Contributor

@Pauan Pauan commented Apr 29, 2020

Some bundlers (such as Webpack) will process require even if it's inside of a conditional branch. Since we only want the require to run in Node, we want Webpack to completely ignore it. Using module.require seems to be the best way to do that.

I would really rather just remove the require completely, but NodeJS 10 is supported until 2021-04-01, so we can't remove it until then.

Fixes #2116

@alexcrichton alexcrichton merged commit 7bee6a8 into rustwasm:master Apr 29, 2020
@Pauan Pauan deleted the fixing-require branch April 30, 2020 02:24
@BenoitDel
Copy link

If this PR is included in was-bindgen v0.2.61. The webpack compilation error is still there.

@Pauan
Copy link
Contributor Author

Pauan commented May 1, 2020

@BenoitDel It is not included in 0.2.61

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

Successfully merging this pull request may close these issues.

node dependency and webpack 5
3 participants