Skip to content

Commit

Permalink
Merge pull request #45 from denysdovhan/fix-brunch-1549
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Dec 27, 2016
2 parents 2d19438 + ab9bf0f commit ace2700
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ class BabelCompiler {
const origPresets = opts.presets;
// this is needed so that babel can locate presets when compiling node_modules
const mapOption = type => data => {
const resolvePath = name => (
resolve(config.paths.root, 'node_modules', `babel-${type}-${name}`)
);
const resolvePath = name => {
// for cases when plugins name do not match common convention
// for example: `babel-root-import`
const plugin = name.startsWith('babel-') ? name : `babel-${type}-${name}`;
return resolve(config.paths.root, 'node_modules', plugin);
};
if (typeof data === 'string') return resolvePath(data);
return [resolvePath(data[0]), data[1]];
};
Expand Down

0 comments on commit ace2700

Please sign in to comment.