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

fix: environment cache invalidation #449

Merged
merged 3 commits into from
Jun 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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