Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize 'ts-invariant/process' again in config/resolveModuleIds.ts.
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 it 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](https://webpack.js.org/configuration/module/#resolvefullyspecified) option is true by default now, and 'ts-invariant/process/package.json' is ignored, effectively forbidding directory-style imports like 'ts-invariant/process' when the package.json of the enclosing package has `"type": "module"` (which became true in Apollo Client v3.5, thanks to #8396). App developers could configure resolve.fullySpecified explicitly false, but we (the Apollo Client team) prefer a general workaround.
- Loading branch information