ts-plugin / ts-plugin/ts-import-plugin

Ability to define a function to define the libraryDirectory or the import path of the component

Open
#917 2 comments 0 reactions 1 assignee View on GitHub

@josejulio is already working on this.

Since Feb 10, 2021.

enhancement PR is Welcome
Dominant language
TypeScript
Stars
603
Forks
36
Avg merge
1m
Merged PRs (30d)
1

Description

I would like to define the library directory programatically. So this value would accept string | (lib: string, component: string) => string.
The use case is that the library I'm using splits into 3 folders, so depending on the requested element, this would change the path.

Ideally it would be something like:

...,
libraryDirectory: (libraryName, requiredComponent) => {
   // do stuff
   return 'dist/foobar/js';
},
....

This is something that I might be able to work on if @Brooooooklyn wants the feature in.

edit: Maybe also other configuration property and instead of returning the libraryDirectory it would return the full import path of the desired component, e.g.:

...,
componentImportPath: (libraryName, requiredComponent) => {
   // do stuff
   return 'dist/foobar/js/my_cool_component';
},
....

Contributor guide

No contributing guide indexed for this repository

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.