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

Alias on partial string? #127

Closed
FezVrasta opened this issue Feb 24, 2017 · 6 comments
Closed

Alias on partial string? #127

FezVrasta opened this issue Feb 24, 2017 · 6 comments

Comments

@FezVrasta
Copy link

FezVrasta commented Feb 24, 2017

I have a set of react components all in the same folder (a_la_lerna).

These components will be published to npm under a namespace, all prefixed by the react- string, I would like to make them depend by each other, example:

Structure:

/packages/foo/index.jsx // on npm will be @namespace/react-foo
/packages/bar/index.jsx // on npm will be @namespace/react-bar

foo/index.jsx:

import Bar from '@namespace/react-bar';
[...]

I would like to make webpack load the modules locally instead of npm while I'm developing, in practice, the import should be transpiled to:

import Bar from 'packages/bar';

Is it possible?

@tleunen
Copy link
Owner

tleunen commented Feb 24, 2017

Hmm... I believe you should be able to set a custom alias for packages/foo into @namespace/react-foo. But then you'll need to do it for all your packages manually.

@FezVrasta
Copy link
Author

Thank you for the answer.
No ways to make this dynamic? based on glob or anything?

@tleunen
Copy link
Owner

tleunen commented Feb 24, 2017

Globbing only works for the root configuration for now.. So because you want a custom alias, I'm afraid it's not currently supported.

@FezVrasta
Copy link
Author

Thank you, I'll try a different solution.

Do you have plans to support glob or a custom function used to match the files?

@tleunen
Copy link
Owner

tleunen commented Feb 24, 2017

Globbing in the alias could be a nice to have. Supporting a custom function is tricky because we can't define the babel config in JS afaik. But we could allow having a reference to a file to setup the matching.

Would you want to work on adding the features?

@FezVrasta
Copy link
Author

Unfortunately I haven't time at the moment 🤕

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

2 participants