Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

Commit

Permalink
fix: use enhancedResolve to resolve babel-core
Browse files Browse the repository at this point in the history
  • Loading branch information
s-panferov committed Nov 1, 2017
1 parent cda6cb2 commit 9f7e978
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { createHash } from 'crypto';
let colors = require('colors/safe');
let pkg = require('../package.json');
let mkdirp = require('mkdirp');
let enhancedResolve = require('enhanced-resolve');

export interface Instance {
id: number;
Expand Down Expand Up @@ -224,11 +225,13 @@ function setupCache(
}
}

const resolver = enhancedResolve.create.sync();

function setupBabel(loaderConfig: LoaderConfig, context: string): any {
let babelImpl: any;
if (loaderConfig.useBabel) {
try {
let babelPath = loaderConfig.babelCore || path.join(context, 'node_modules', 'babel-core');
let babelPath = loaderConfig.babelCore || resolver(context, 'babel-core');
babelImpl = require(babelPath);
} catch (e) {
console.error(BABEL_ERROR, e);
Expand Down

0 comments on commit 9f7e978

Please sign in to comment.