Assumption:
When using import { MyType } from 'type-package', I think resolver try to resolve first in JS code before search in types.
This problem does not occur when use import type { MyType } from 'type-package'; certainly because with explicit import type, the resolver search directly in types exports.
So I have added an empty JS file to solve this behavior, but I think it's still better to use explicit import type (IMHO: it's also more explicit for developers readability)
Boyscout
Add specific tsconfig for build to exclude tests code from build (useless to build test code and unnecessarily packaged in npm package)
What does this PR do ?
Fix strange resolver behavior for package without main JS file, result in bug with Vite builder (and maybe other). CF: https://github.com/vitejs/vite/issues/12446
Assumption: When using
import { MyType } from 'type-package'
, I think resolver try to resolve first in JS code before search in types. This problem does not occur when useimport type { MyType } from 'type-package'
; certainly because with explicitimport type
, the resolver search directly in types exports. So I have added an empty JS file to solve this behavior, but I think it's still better to use explicitimport type
(IMHO: it's also more explicit for developers readability)Boyscout
tsconfig
for build to exclude tests code from build (useless to build test code and unnecessarily packaged in npm package)