Skip to content

Commit

Permalink
feat: Make alias config take precedence over root config (#221)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This makes alias taking precedence over the root config because it's usually more specific.
  • Loading branch information
tleunen committed Oct 19, 2017
1 parent 0a16ea8 commit 3c711f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/resolvePath.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ function resolvePathFromAliasConfig(sourcePath, currentFile, opts) {
}

const resolvers = [
resolvePathFromRootConfig,
resolvePathFromAliasConfig,
resolvePathFromRootConfig,
];

export default function resolvePath(sourcePath, currentFile, opts) {
Expand Down
10 changes: 5 additions & 5 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,23 +264,23 @@ describe('module-resolver', () => {
});

describe('root and alias', () => {
const rootTransformerOpts = {
const aliasTransformerOpts = {
babelrc: false,
plugins: [
[plugin, {
root: './test/testproject/src',
root: './test/fakepath/',
alias: {
constants: 'constants/actions',
constants: './test/testproject/src/constants',
},
}],
],
};

it('should resolve the path using root first and alias otherwise', () => {
it('should resolve the path using alias first and root otherwise', () => {
testWithImport(
'constants',
'./test/testproject/src/constants',
rootTransformerOpts,
aliasTransformerOpts,
);
});
});
Expand Down

0 comments on commit 3c711f8

Please sign in to comment.