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

Allow 'nested' aliases in resolve config #166

Merged
merged 1 commit into from Feb 8, 2016

Conversation

nosnickid
Copy link
Contributor

In my project, I have nested my private aliases in a namespace-ish manner.

My resolve.alias looks somewhat like:

resolve: {
  alias: {
    'ns/module1': path.resolve('...'),
    'ns/module2': path.resolve('...')
  }
}

This functions in webpack but wasn't functioning with the slightly simpler implementation of matchAlias in the webpack resolver.

This patch looks for a common prefix in the source and alias in matchAlias and fixes configs as above.

@benmosher
Copy link
Member

Ah, interesting. I had not considered this given that it was not in the Webpack table.

I wonder if path.relative could be used for this... something like a path version of indexOf that is separator-agnostic...

Thanks for this! and thanks for the tests!

benmosher added a commit that referenced this pull request Feb 8, 2016
Allow 'nested' aliases in resolve config
@benmosher benmosher merged commit 6352c1a into import-js:master Feb 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants