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

[Bug]: wrong tsconfig.json#paths output when bundle: false #407

Open
carlosmfreitas2409 opened this issue Nov 11, 2024 · 4 comments
Open

Comments

@carlosmfreitas2409
Copy link

carlosmfreitas2409 commented Nov 11, 2024

Version

Rslib 0.0.16

Details

When using bundle: false, the TS path aliases are not being correctly generated in the build.
When using bundle: true, it generates correctly, but it is not what I want.

  • tsconfig.json
{
  "extends": "@repo/tsconfig/react.json",
  "include": ["src", "stories"],
  "compilerOptions": {
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}
  • rslib config
    Image

  • rslib output
    Image

  • build script
    rslib build

@fi3ework
Copy link
Member

Since the request is externalized, it won't follow Rsbuild's default alias behavior(https://rsbuild.dev/guide/advanced/alias). It's better to be aligned.

@carlosmfreitas2409
Copy link
Author

Hi @fi3ework.

Sorry, I didn't quite understand what you meant.
Are you saying to use source.alias and source.aliasStrategy in rslib config?
If so, I've tried using them too, but it didn't change anything.

@fi3ework
Copy link
Member

source.alias or source.aliasStraategy won't make it work. The alias to an source path (which means it's dynamic after resolved) need getResolve function #238 (comment).

@Timeless0911
Copy link
Collaborator

web-infra-dev/rspack#7348 external function getResolve will be supported after this pr merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants