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

Commit

Permalink
fix: environment cache invalidation (#449)
Browse files Browse the repository at this point in the history
fix: environment cache invalidation
  • Loading branch information
ArgonAlex authored and s-panferov committed Jun 28, 2017
1 parent f14eaab commit c073af1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export function ensureInstance(

let babelImpl = setupBabel(loaderConfig, context);
let cacheIdentifier = setupCache(
compilerConfig,
loaderConfig,
tsImpl,
webpack,
Expand Down Expand Up @@ -190,13 +191,13 @@ export function setupTs(compiler: string): CompilerInfo {
}

function setupCache(
compilerConfig: TsConfig,
loaderConfig: LoaderConfig,
tsImpl: typeof ts,
webpack: Loader,
babelImpl: any,
context: string
) {
let cacheIdentifier = null;
if (loaderConfig.useCache) {
if (!loaderConfig.cacheDirectory) {
loaderConfig.cacheDirectory = path.join(context, '.awcache');
Expand All @@ -206,13 +207,14 @@ function setupCache(
mkdirp.sync(loaderConfig.cacheDirectory);
}

cacheIdentifier = {
'typescript': tsImpl.version,
return {
typescript: tsImpl.version,
'awesome-typescript-loader': pkg.version,
'awesome-typescript-loader-query': webpack.query,
'babel-core': babelImpl
? babelImpl.version
: null
'babel-core': babelImpl ? babelImpl.version : null,
babelPkg: pkg.babel,
// TODO: babelrc.json/babelrc.js
compilerConfig,
env: process.env.BABEL_ENV || process.env.NODE_ENV || 'development'
};
}
}
Expand Down

0 comments on commit c073af1

Please sign in to comment.