-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[gatsby] core-js@3 incompatibility: Compile error, dependency not found #17136
Comments
Forgot to add: Node.js
I will continue diagnosing the issue and attempt to submit a PR, it is probably a fault with |
I have new reduced examples. Reduced gatsby example, webpack error: Only webpack, works fine: I assume this is a problem with Gatsby's Webpack configuration, as regular webpack works, as per the documentation. I will continue to do some digging. |
@MarcusCemes i'm inclined to believe that this is more of a incompatibility between the package and gatsby. I've tinkered with both and the only version i was able work with gatsby was Did some tests with create react app and i was able make it work, also did some tests with another ssr framework, namely nextjs and i was able to make it work. Also applied some webpack configuration in exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
if (stage === "build-html") {
actions.setWebpackConfig({
module: {
rules: [
{
test: /redoc/,
use: loaders.null(),
},
],
},
})
}
} Also tried using it with react-loadable and the issue still persisted. In the meantime i think it's a good idea to post a issue in the package repo and mention this one and see what the feedback is. I have the version with the alpha version hoisted here. |
Thanks @jonniebigodes for the digging. There is a recent closed (but unresolved and ongoing) issue on what seems to be a related issue (it was deemed "fixed" in I'll follow and assist in the referenced issue and keep this updated, I'll leave it to a moderator to decide whether to close/keep this issue open, as I still don't know where the problem resides. |
@MarcusCemes no need to thank. i'll keep an eye on this aswell |
Also hit this problem today. I had some additional issues importing specific Will investigate a little bit today. |
The problem is that Gatsby uses/hardcodes
The import above is for |
There is no simple way out of this, since |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
As far as I'm concerned, this is still an open issue, as it seems that libraries using I'll leave the question of to close or not to close to someone with more of an idea of the complexity of the issue. |
@MarcusCemes As a workaround you could remove our core-js alias from the webpack config. This might increase your javascript bundle.
I'm not 100% sure the code is in 100% working state but something along these lines should do the trick |
@wardpeet Thank you for the comment, although I was unable to solve the issue. I am not familiar with Gatsby's under-the-hood configurations, and wouldn't feel safe trying to monkey-patch the configuration. Perhaps it may help someone else. I have also updated the code sandbox with the above-proposed workaround (does not resolve the issue). |
I think I missed the chaining. exports.onCreateWebpackConfig = ({ actions, getConfig }) => {
const config = getConfig();
delete config.resolve.alias["core-js"];
actions.replaceWebpackConfig(config);
}; |
Ok sorry for the late response but this came up again, this should fix your issue: In gatsby-node.js
so what are we doing here? The try-catch is needed because core-js@3 might not be a direct child of your gatsby site. Technically it's not needed but it will make your bundle a bit smaller as everything will point to the same core-js@3 library so webpack won't load the same file more than once in the same bundle. |
Thank you for your continued support. The above configuration does allow gatsby to start correctly, but the problem (at least with This may be an internal issue with the After having done another search of gatsby issues (now knowing the cause of this one), this seems to be a duplicate of (or at least solvable by) #15601. I'm closing this issue in favour of that one. Supporting |
Description
This seems like a webpack error, but I thought it might be more relevant here, as gatsby heavily manages webpack?
Unable to install and use Redoc. The compiler fails on line 6454 of
node_modules/redoc/bundles/redoc.lib.js
:After checking
node_modules
, I can confirm the existence ofcore-js/es/promise/index.js
with the following export:VS Code is also able to resolve the required path with a CTRL+Click.
Gatsby develop error
Gatsby build error
Steps to reproduce
Absolute minimal example (may need to fork to run the sandbox):
https://codesandbox.io/embed/gatsbyredoc-dependancy-not-found-bug-csr12
npm i redoc
, and its peer dependanciesnpm i mobx styled-components core-js
Expected result
The project compiles successfully
Actual result
Webpack is unable to resolve a
require(...)
dependency.Environment
My enviroment
Codesandbox minimal enviroment
The text was updated successfully, but these errors were encountered: