-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Bug] (Create React App) Issues with resolving an .mjs file instead of an .js file leading to test failures #1248
Comments
@joshuanutmeg Can you please provide more details on how you building Not sure but maybe it's related to changes from #1244 |
0.13.0 works fine, changing the package.json to |
The only thing I could think of that had impacted it was the mjs change as you outlined ^^ |
I'm not building anything, the bundle should be built as part of the npm install process afaik |
Having a similar issue with this version on my Jest test setup. Previous version
|
I've got similar issue(at Jest).
|
I had a similar issue with a |
Actually, all these projects seem to be Apollo, not servers or anything else. |
I'm having a similar problem with this version, here's the traceback: Text version:
|
Broken here, as well.
|
Could someone encountering this issue share more details about their environment? I've yet to reproduce any issue, but it sounds like a commonality is Jest test environments and Apollo clients. Can someone link to the code for a jest environment that's causing these issues? |
Yes, I'm using Jest (technically, Create React App, which comes with Jest built-in) and react-apollo. |
@stevensacks Me too exactly same stack. @leebyron i'll comment some infomation by my personal project ... ↓ circleci build faild log with this issue. ↓ entire repository of commit when facing this issue. ↓ faild specific jest test file
|
@leebyron why'd you change the title? it looks like it is looking for mjs files when they don't exist - they're all .js files in the src |
I wouldn't say Jest is an issue, all of these issues are going though |
"0.13.1 is broken" isn't a great title - the version is working correctly outside of this particular issue and we need to narrow down what's going on. The cause, as I see it is that when the file "parser" is being required, that this resolves to "parser.mjs" instead of "parser.js" despite the mjs import syntax not being understood. Node's module resolution will always resolve "parser" to "parser.js" (unless from another mjs file when using --experimental-modules), so there must be a different module resolver causing this issue. The reason I assumed Jest was a direction to investigate is that Jest uses a custom module resolver and almost all reports in this issue are failing Jest tests. Has anyone been able to create a test repo which consistently exhibits this issue? I've still yet to reproduce it. Once I have my hands on a consistent reproduction then I can help to debug the root cause. |
Hi there, I'm also seeing this issue. As with the other reporters, this is a Create React App application testing with the default configuration. See this repo for an example with the failing test: Run |
Also, I can confirm that forcing graphql back to version 0.13.0 resolves the issue. |
It also causes a bunch of issues with webpack 4 |
@mikehazell you'll have to add
|
New title is more fitting :) thanks |
I think I've found the source issue, this arrives when using
This was introduced in facebook/create-react-app#3239 / facebook/create-react-app@5c8000f |
Also - if you're encountering an issue and not using create-react-app or Jest, let's please open new issues so we can diagnose those as well. |
As an update - the fix to create-react-app was merged, however still awaiting a point release which will hopefully happen soon. |
There are still issues using graphql > 0.13.0 with create-react-app even after applying the fix @leebyron recommended. Jest tests run successfully (thanks for the tip on that!), but when using |
@mbrowne could you clarify what else you're seeing? I've set up a small test that uses It would be helpful to see any additional context you have in reproducing other issues. |
@leebyron did you try actually running the app? It compiles successfully but throws the
This was with graphql 0.13.2 and graphql-tag 2.8.0 |
I concur with what @mbrowne has said |
If your project is built with Create React App and not ejected, https://github.com/facebook/create-react-app/releases/tag/v1.1.2 Otherwise you can apply a similar fix yourself in your project config. Cheers! |
Just to be clear (at least based on the "similar fix" link), the fix above fixes the Jest issue but not the compatibility issue with graphql-tag. Should I suggest to the Apollo team that apollographql/graphql-tag#155 be reopened? Perhaps it's unrelated to this issue after all... |
I’ll re-open and re-investigate! Thanks for flagging
…On Mon, Apr 2, 2018 at 5:36 PM Matt Browne ***@***.***> wrote:
Just to be clear (at least based on the "similar fix" link), the fix above
fixes the Jest issue but not the compatibility issue with graphql-tag.
Should I suggest to the Apollo team that apollographql/graphql-tag#155
<apollographql/graphql-tag#155> be reopened?
Perhaps it's unrelated to this issue after all...
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1248 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABERRu7e_ULC9J6wrctf8FaBy9f37lwJks5tksPpgaJpZM4SINTr>
.
|
This is a way to guarantee that users install [email protected] instead of 13.2 (which is broken) graphql/graphql-js#1248
Just tested through this again and can confirm that using I tested this by making a new project @mbrowne - I'd recommend making sure everything is on the latest version and you don't have any competing custom configuration that would cause |
Before closing the thread, isn’t it better to confirm with the people that are reporting issues first? |
More than happy to reopen this issue or open new issues if there are additional reports of reproducible issues. I closed this one since the original issue was diagnosed, patched, shipped, and confirmed fixed |
I was unable to verify the fix after 0.13.2 was released - i will check the above tomorrow at work and let you know how it goes. Thanks for your help so far |
The graphql-tag issue (apollographql/graphql-tag#155) was reopened. It appears unrelated. So as far as I'm concerned it's fine to close this, thanks. |
Sorry for not following up. I can confirm this has been fixed. |
* Fix production build The production build failing was the result of a bug related to an older version react-scripts not playing nice with the latest version of graphql (graphql/graphql-js#1248). Updating to the latest version of react-scripts (v2.1.1) fixed the bug. It also reduces the production build *considerably* (from over 1mb down to 48kb). * Downgrade babel-preset-react-app to 3.1.0
* Fix production build The production build failing was the result of a bug related to an older version react-scripts not playing nice with the latest version of graphql (graphql/graphql-js#1248). Updating to the latest version of react-scripts (v2.1.1) fixed the bug. It also reduces the production build *considerably* (from over 1mb down to 48kb). * Downgrade babel-preset-react-app to 3.1.0
* Fix production build The production build failing was the result of a bug related to an older version react-scripts not playing nice with the latest version of graphql (graphql/graphql-js#1248). Updating to the latest version of react-scripts (v2.1.1) fixed the bug. It also reduces the production build *considerably* (from over 1mb down to 48kb). * Downgrade babel-preset-react-app to 3.1.0
* Fix production build The production build failing was the result of a bug related to an older version react-scripts not playing nice with the latest version of graphql (graphql/graphql-js#1248). Updating to the latest version of react-scripts (v2.1.1) fixed the bug. It also reduces the production build *considerably* (from over 1mb down to 48kb). * Downgrade babel-preset-react-app to 3.1.0
Running tests on a local project get's the following errors since the publish of 0.13.1
The text was updated successfully, but these errors were encountered: