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

Resolve ts-invariant/process module identifier again in config/resolveModuleIds.ts #9083

Merged
merged 2 commits into from
Nov 18, 2021

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Nov 18, 2021

From @apollo/client@3.5.0 until my recent PR #9073 (v3.5.3), non-relative imported module identifiers like ts-invariant/process were rewritten during the build process (during npm run resolve) to include a specific module with a file extension (not a directory), producing in this example ts-invariant/process/index.js.

That rewriting was the wrong choice in general (for example, it would rewrite graphql to graphql/index.mjs), so PR #9073 disabled the rewriting for all non-relative imports.

However, the specific replacement of ts-invariant/process with ts-invariant/process/index.js is still useful to prevent the strange webpack 5-specific error

The request 'ts-invariant/process' failed to resolve only because it was resolved as fully specified

which apparently happens because the resolve.fullySpecified option is true by default now. App developers could configure resolve.fullySpecified explicitly false, but we (the Apollo Client team) prefer a general workaround.

In other words, this PR refines the changes from #9073 to reenable one specific non-relative module rewriting (the same module mentioned in the commit message 60e18e9, ts-invariant/process).

@benjamn benjamn force-pushed the appease-webpack-5-fullySpecified-errors branch from c767c02 to 5dacee3 Compare November 18, 2021 21:55
Copy link
Contributor

@brainkim brainkim left a comment

Choose a reason for hiding this comment

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

🎉

@benjamn benjamn linked an issue Nov 18, 2021 that may be closed by this pull request
@benjamn benjamn merged commit 9b6886c into main Nov 18, 2021
@benjamn benjamn deleted the appease-webpack-5-fullySpecified-errors branch November 18, 2021 22:06
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
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.

Webpack project fails to compile with @apollo/client 3.5.3
2 participants