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(gatsby): cleanup fullySpecified resolving #29576

Merged
merged 4 commits into from
Feb 22, 2021
Merged

Conversation

wardpeet
Copy link
Contributor

@wardpeet wardpeet commented Feb 18, 2021

Description

I did some more researching and we can disable fullySpecified in better way for all ESM modules. This allows us to skip fullySpecified on all js loaders.

How to test

import ky from "ky" inside your project to trigger this bug.

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Feb 18, 2021
@wardpeet wardpeet added topic: webpack/babel Webpack or babel and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Feb 18, 2021
@wardpeet wardpeet merged commit 1343d38 into master Feb 22, 2021
@wardpeet wardpeet deleted the fix/plugin-resolvetypes branch February 22, 2021 06:32
@karlhorky
Copy link
Contributor

karlhorky commented Apr 27, 2021

Is there an easy way to override the webpack config in Gatsby to enable fullySpecified? (eg. for users who want to opt in to full ESM with .js file extensions)

Ideally an easy to copy-paste example with two versions:

  1. Opt in to fullySpecified everywhere
  2. Opt in to fullySpecified for only some file(s) (eg. based on a pattern)

Then any users who are trying to do this can at least be pointed to the comment with the code examples in this PR.

@karlhorky
Copy link
Contributor

karlhorky commented Apr 27, 2021

I guess this could also have to do with the javascript/auto config?

Or maybe module: false or useESModule from Babel?

@karlhorky
Copy link
Contributor

I guess according to the comment from @wardpeet, this should work out of the box:

We have tried the example above and we couldn't see the above error.

@karlhorky
Copy link
Contributor

There may still be an issue with TypeScript though.

@wardpeet
Copy link
Contributor Author

We would love to get a small reproduction and an issue to see where this is a problem.

@karlhorky
Copy link
Contributor

Done, over here: #31077 (comment)

But I guess this actually may be a problem with webpack itself (or at least babel-loader and ts-loader):

webpack/webpack#13252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: webpack/babel Webpack or babel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants