-
Notifications
You must be signed in to change notification settings - Fork 25
Description
First, my specific example that led to finding this issue:
I have source modules that may require either the core React module or the React module with addons, such as:
var React = require('react');
// OR
var React = require('react/addons');I am attempting to use aliasify to map any requires of react to react/addons. However, I want to leave requires for react/addons untouched. When I include the following in my package.json, require('react/addons') becomes require('react/addons/addons'):
"aliasify": {
"aliases": {
"react": "react/addons"
}
}At first, I thought this might be a bug with aliasify being too lenient, but it looks like it's expected functionality, considering this test to ensure paths after aliases are maintained.
I attempted to work around this by using quote marks in my package.json, like so:
"aliasify": {
"aliases": {
"'react'": "'react/addons'"
}
}Hoping that I would be able to do an 'exact' match against only requires for 'react', but to no avail.
This pattern of modules exposing differing or extended functionality via sub-modules (e.g. Less 2.0.0 just introduced less/browser as a valid require target) seems to not be that uncommon, so I was curious as to whether you feel there's a way to improve aliasify to be smarter about aliasing modules names with this pattern.
Thanks.