Stop eagerly forcing compilation of lazy CssOutputResources.

This should be a better fix for the problem I tried to fix with
479e505d71.

If we're going to be using compileOneFileLater by default, that's what we
should be testing in the compiler plugins self-tests.
This commit is contained in:
Ben Newman
2018-06-22 11:16:59 -04:00
parent f7f3d34181
commit de3fef17ca
3 changed files with 11 additions and 10 deletions

View File

@@ -316,8 +316,7 @@ CachingCompiler = class CachingCompiler extends CachingCompilerBase {
};
if (this.compileOneFileLater &&
inputFile.supportsLazyCompilation &&
! this._cacheDebugEnabled) {
inputFile.supportsLazyCompilation) {
await this.compileOneFileLater(inputFile, getResult);
} else {
const result = await getResult();

View File

@@ -148,8 +148,7 @@ extends CachingCompilerBase {
};
if (this.compileOneFileLater &&
inputFile.supportsLazyCompilation &&
! this._cacheDebugEnabled) {
inputFile.supportsLazyCompilation) {
if (! this.isRoot(inputFile)) {
// If this inputFile is definitely not a root, then it must be
// lazy, and this is our last chance to mark it as such, so that

View File

@@ -722,7 +722,7 @@ class ResourceSlot {
});
if (this.packageSourceBatch.useMeteorInstall &&
options.lazy) {
cssResource.lazy) {
// If the current packageSourceBatch supports modules, and this CSS
// file is lazy, add it as a lazy JS module instead of adding it
// unconditionally as a CSS resource, so that it can be imported
@@ -778,12 +778,15 @@ class ResourceSlot {
// stub, so setting .implicit marks the resource as disposable.
}).implicit = true;
// If there was an error processing this file, cssResource.data will
// not be a Buffer, and accessing cssResource.data here should cause
// the error to be reported via inputFile.error.
if (Buffer.isBuffer(cssResource.data)) {
this.outputResources.push(cssResource);
if (! cssResource.lazy &&
! Buffer.isBuffer(cssResource.data)) {
// If there was an error processing this file, cssResource.data
// will not be a Buffer, and accessing cssResource.data here
// should cause the error to be reported via inputFile.error.
return;
}
this.outputResources.push(cssResource);
}
}