-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
nodeRequire is not a function #7669
Comments
So, I found this solution: within my entry point I added this line: global.require = __non_webpack_require__; @mramato do you see another, potentially more elegant, solution? Otherwise, feel free to close this. |
Little update: While debugging my script, I came across the same error again, this time not webpack related. I had to add this to my source file, to get it to work: global.require = process.env.NODE_ENV === 'production' ? __non_webpack_require__ : require; |
So, I added the following little repo to outline the issue better and maybe give you a better understanding of where the issue lies. |
Thanks for the detailed write up @bkuster and sorry for the slow reply here. Unfortunately webpack's fragility has led to breakage like this in the past but it should hopefully be an easy fix, we may actually be able to just revert the change that caused this problem to begin with, but I'll know more once I dig into it. We'll definitely try and get this fixed before the next release. |
@bkuster Sorry if I'm missing something obvious but just wanted to confirm your exact use case. It looks like you are writing a Node.js app but using webpack to build it? This isn't a browser application but a Node one? |
@mramato, yes that is the use case. I know it's an atypical approach, but we mangle our server side code sometimes. Note, that in the repo I provided, the error remains the same with or without webpack (but using the |
Thanks. Building/minifying Node.js code is actually something I need to explore myself at some point, so I understand the use case. I need to think through all of the implications here so we don't break one of the other combinations by fixing this use case. Unfortunately that means a fix won't make it into today's release, but I'm hopeful it will with the next one. Your repository example will be a huge help. |
@mramato thanks for the update. I did not expect a quick fix tbh. and have found a workaround which works fine for now (but is very webpack specific). |
The Issue:
After updating one of my server components from npm cesium
1.50
to1.55
, I can no longer request resources do to the following error:nodeRequire is not a function
.What has changed:
https://github.com/AnalyticalGraphicsInc/cesium/blob/ead9f36a9b155a1d2dada9f8724b531d09195c7a/Source/Core/Resource.js#L1913-L1918
What causes the Issue
This does not play nicely with webpack.
Tried work arounds:
global.require = require
within my code -> webpack cant findurl
.cesium
withnoParse
-> missingdefine
.The text was updated successfully, but these errors were encountered: