From cf71259080df736ca9f54111145a8b0d7b252578 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Thu, 9 Feb 2017 11:55:42 -0500 Subject: [PATCH] Overwrite implicit modules only if they are package.json files. Implicit empty stub CSS modules added in addStylesheet in compiler-plugin.js were being overwritten with actual CSS module code, thanks to logic intended to support replacing package.json stubs with their actual contents. The meaning of "implicit" is somewhat overloaded: for package.json modules, it means the module is a minimal stub (just the "name", "version", and "main"/"browser" fields) that should be replaced if ever explicitly imported. For empty stub CSS modules, it means the module should yield to any actual modules added via addJavaScript. --- tools/isobuild/import-scanner.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/isobuild/import-scanner.js b/tools/isobuild/import-scanner.js index bf90b66711..168cefac74 100644 --- a/tools/isobuild/import-scanner.js +++ b/tools/isobuild/import-scanner.js @@ -562,9 +562,11 @@ export default class ImportScanner { let depFile = this._getFile(absImportedPath); if (depFile) { - // If the module was imported implicitly before, update to the + // If the module is an implicit package.json stub, update to the // explicit version now. - if (depFile.implicit === true) { + if (depFile.jsonData && + depFile.installPath.endsWith("/package.json") && + depFile.implicit === true) { const file = this._readModule(absImportedPath); if (file) { depFile.implicit = false;