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

dynamic importPaths based on component subpaths #154

Open
ericandrewscott opened this issue Sep 6, 2024 · 0 comments
Open

dynamic importPaths based on component subpaths #154

ericandrewscott opened this issue Sep 6, 2024 · 0 comments

Comments

@ericandrewscott
Copy link

ericandrewscott commented Sep 6, 2024

We have our config file set up to rename the import from our specific package, eg:
import { Button } from '@namespace/react-core';

BUT, we can't account for our customers properly implementing tree-shaking of our library, so we'd like to enable dynamic import subpaths, eg:
import { Button } from '@namespace/react-core/button';
This would ensure that the bundle sizes for anyone importing components from our library stay as small as possible. We also can't count on them using the ESM versions of our components (I know, I know... welcome to modern JS).

Is there an easy way to do this dynamically, instead of literally adding every component to our figma.config.json, eg:

  "importPaths": {
    "path-to-button/*": "@namespace/react-core/button",
    "path-to-input/*": "@namespace/react-core/input",
    ...
  }
  "paths": {
    "./**":["path-to-components/**/*"]
  },

If there was a way to dynamically path the imports, that would help us not n+1 our importPaths as we add Code Connect files to our components.

  • Code Connect CLI version 1.0.6
  • Operating system OSX
@ericandrewscott ericandrewscott changed the title dynamic importPaths based on component directory pathing dynamic importPaths based on component subpaths Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant