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

multiple package.json use name instead of local path #519

Open
philolo1 opened this issue Sep 12, 2018 · 1 comment
Open

multiple package.json use name instead of local path #519

philolo1 opened this issue Sep 12, 2018 · 1 comment

Comments

@philolo1
Copy link
Contributor

Hi, i am using multiple package.json in react native and i was wondering whether its currently possible to use the package name instead of the the local path when import-js adds a package.

For example in the folder src/constants/package.json looks like this.

{
  "name": "@constants"
}

Furthermore lets assume i have a file src/constants/colors.js that exports colors. Lets say i want to use colors in src/components/myfile.js

Then import-js suggests

import colors from '../constants/colors.js'

What i would like to have is '@constants/colors.js'. Is there a way to do that and if not, how would you like this to be implemented. Can we use this as a default option or would we need a property in the .import-js config?

@trotzig
Copy link
Collaborator

trotzig commented Sep 13, 2018

Interesting, I have never used local names like these. I think this could be implemented as a new default, but a quick-fix would be to use moduleNameFormatter to reformat the module name before imports are written to file.

This was referenced Feb 5, 2024
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

2 participants