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

Fix mjs handling for graphql #5257

Closed
wants to merge 1 commit into from
Closed

Conversation

Timer
Copy link
Contributor

@Timer Timer commented Oct 2, 2018

Fixes #5234.
Closes #5235.

This pull request allows packages to import from dependencies who export a mjs file (instead of us giving a URL).
It also ensures that a user who uses mjs in their application gets a file.

I'm really getting tired of all of these mjs hacks, because now we "sort of" support mjs. e.g.:
If a user defines their module field in package.json as index.mjs and then explicitly import files with .mjs instead of being extensionless, we'll keep loading them.


I wonder if we can somehow tell webpack to not use module if the field is mjs? That would prevent this hack.

@Timer Timer added this to the 2.0.4 milestone Oct 2, 2018
// https://github.com/facebook/create-react-app/issues/5234
describe('issue #5234 (mjs files are imported as static files)', () => {
it('correctly bundles files in development', async () => {
const browser = await puppeteer.launch({ headless: true });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puppeteer! Nice.

@Timer
Copy link
Contributor Author

Timer commented Oct 2, 2018

I really don't like this PR. I'd like to somehow use the main key if module is a mjs file.

Then again, this will probably be standard behavior in a few more months when Node stabilizes its direction and Jest adds formal support.

@Timer Timer closed this Oct 3, 2018
@Timer Timer deleted the fix-mjs-support branch October 3, 2018 00:35
@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants