Skip to content

[js lib with ts & vite] Invalid imports in generated d.ts for project with tsconfig path alias defined for any module #30814

@efriandika

Description

@efriandika

Current Behavior

When a publishable package is importing something from another package, it's importing the relative path instead of importing the package name.

Eg:

import Something from '../../../../somewhere';

Expected import:

import Something from '@scope/example-2';

Expected Behavior

import Something from '@scope/example-2';

GitHub Repo

No response

Steps to Reproduce

  1. Create fresh nx project with ts and vite (it will automatically install latest vite-plugin-dts)
  2. Create 2 example publishable packages (example-1, example-2)
  3. In example-1, Import some types from example-2 then build.1.

Nx Report

...

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

This was working fine with vite-plugin-dts v3.6.4.

However, the latest version seems to have a new config that was introduced that had changed some behaviour.
It might worth to include that configs in nx default template.

See this discussion:
qmhc/unplugin-dts#330 (comment)

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions