`types` and `exports` in dependency package.json break module specifier generation
andrewbranch opened this issue · 1 comments
andrewbranch commented
#46159 seems to cause us to ignore the top-level types
field when there’s an exports
field when trying to see if we can resolve a node_modules path to a package-style module specifier. Complete failing fourslash test:
// @module: commonjs
// @Filename: /node_modules/react-hook-form/package.json
//// {
//// "name": "react-hook-form",
//// "main": "dist/index.cjs.js",
//// "module": "dist/index.esm.js",
//// "types": "dist/index.d.ts",
//// "exports": {
//// "./package.json": "./package.json",
//// ".": {
//// "import": "./dist/index.esm.js",
//// "require": "./dist/index.cjs.js"
//// }
//// }
//// }
// @Filename: /node_modules/react-hook-form/dist/index.cjs.js
//// module.exports = {};
// @Filename: /node_modules/react-hook-form/dist/index.esm.js
//// export function useForm() {}
// @Filename: /node_modules/react-hook-form/dist/index.d.ts
//// export function useForm(): any;
// @Filename: /index.ts
//// useForm/**/
verify.importFixModuleSpecifiers("", ["react-hook-form"]);
weswigham commented
This is 100% fully working as intended. exports
blocks main
lookup, and types
is just ts-specific main
.