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.
This commit is contained in:
Ben Newman
2017-02-09 11:55:42 -05:00
parent 1b7ceab6d5
commit cf71259080

View File

@@ -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;