ui5-community / ui5-community/babel-plugin-transform-modules-ui5

[FEATURE REQUEST] Support typescript path mapping

Open
#137 5 comments 0 reactions 1 assignee View on GitHub

@petermuessig is already working on this.

Since Dec 6, 2024.

Dominant language
JavaScript
Stars
33
Forks
20
Avg merge
3h 22m
Merged PRs (30d)
1

Description

In tsconfig.json, it is possible to add a path mapping configuration like this.

{
    "compilerOptions": {
        "paths": {
	    "@/*": ["*"]
        }, 
        .......
    }
}

It help to avoid writing deep relative import path. E.g. import { getMyUtility } from "@/utils"; instead of import { getMyUtility } from "../../../../utils";

But this feature is not supported by babel-plugin-transform-modules-ui5 at runtime when running ui5 serve on dev mode. The transpiled UI5 code resource treats such imports as an url path that contains '@/utils' and thus failed to load the resource.

It would be great to support path mapping for both dev mode and production bundling.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.