Created
October 4, 2016 21:03
-
-
Save mirkonasato/903e039bf341707776c402497afc25bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/bundle.ts b/src/bundle.ts | |
index a99651e..b995701 100644 | |
--- a/src/bundle.ts | |
+++ b/src/bundle.ts | |
@@ -35,6 +35,9 @@ export function bundleUpdate(event: string, path: string, context: BuildContext, | |
} | |
+// used to track the cache for subsequent bundles | |
+let bundleCache: RollupBundle = null; | |
+ | |
function runBundle(context: BuildContext, options: BuildOptions, rollupConfig: RollupConfig, useCache: boolean): Promise<any> { | |
rollupConfig = fillConfigDefaults(context, rollupConfig, ROLLUP_TASK_INFO); | |
@@ -114,26 +117,6 @@ function getModulesPathsCachePath(): string { | |
} | |
-// used to track the cache for subsequent bundles | |
-let bundleCache: RollupBundle = null; | |
- | |
-export function clearCachedModule(id: string) { | |
- if (bundleCache) { | |
- const cachedModule = bundleCache.modules.find(m => m.id === id); | |
- if (cachedModule) { | |
- const index = bundleCache.modules.indexOf(cachedModule); | |
- if (index > -1) { | |
- bundleCache.modules.splice(index, 1); | |
- Logger.debug(`clearCachedModule: ${id}`); | |
- return true; | |
- } | |
- } | |
- } | |
- Logger.debug(`clearCachedModule: no existing bundleCache to clear`); | |
- return false; | |
-} | |
- | |
- | |
function createOnWarnFn() { | |
const previousWarns: {[key: string]: boolean} = {}; | |
diff --git a/src/template.ts b/src/template.ts | |
index 22eb9a4..9d95c59 100644 | |
--- a/src/template.ts | |
+++ b/src/template.ts | |
@@ -1,5 +1,5 @@ | |
import { BuildContext, BuildOptions, Logger, isTsFilename } from './util'; | |
-import { bundleUpdate, clearCachedModule } from './bundle'; | |
+import { bundleUpdate } from './bundle'; | |
import { dirname, join, parse, basename, sep } from 'path'; | |
import { readFileSync, readdirSync } from 'fs'; | |
import { sassUpdate } from './sass'; | |
@@ -23,17 +23,6 @@ export function templateUpdate(event: string, path: string, context: BuildContex | |
function runTemplateUpdate(event: string, path: string, context: BuildContext, options: BuildOptions) { | |
Logger.debug(`templateUpdate, event: ${event}, path: ${path}`); | |
- | |
- if (event === 'change') { | |
- // just a change event, see if this html file has a component in the same directory | |
- // doing this to prevent an unnecessary TS compile and bundling without cache if it was just a HTML change | |
- const componentFile = getSourceComponentFile(path, context); | |
- if (clearCachedModule(componentFile)) { | |
- // we successfully found the compiled JS file and cleared it from the bundle cache | |
- return bundleUpdate(event, path, context, options, true); | |
- } | |
- } | |
- | |
// not sure how it changed, just do a full rebuild without the bundle cache | |
return bundleUpdate(event, path, context, options, false).then(() => { | |
return sassUpdate(event, path, context, options, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment