mirror of https://github.com/webpack/webpack.git
Merge branch 'master' into next
# Conflicts: # lib/dependencies/HarmonyExportImportedSpecifierDependency.js
This commit is contained in:
commit
4c2f9e724b
|
|
@ -120,7 +120,7 @@ class ExternalModule extends Module {
|
|||
updateHash(hash) {
|
||||
hash.update(this.type);
|
||||
hash.update(JSON.stringify(this.request));
|
||||
hash.update(JSON.stringify(this.optional));
|
||||
hash.update(JSON.stringify(Boolean(this.optional)));
|
||||
super.updateHash(hash);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|||
// try to learn impossible exports from other star exports with provided exports
|
||||
for(const otherStarExport of this.otherStarExports) {
|
||||
const otherImportedModule = otherStarExport.module;
|
||||
if(Array.isArray(otherImportedModule.providedExports)) {
|
||||
if(otherImportedModule && Array.isArray(otherImportedModule.providedExports)) {
|
||||
for(const exportName of otherImportedModule.providedExports)
|
||||
result.add(exportName);
|
||||
}
|
||||
|
|
@ -272,6 +272,8 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|||
if(!dep.name) {
|
||||
const importedModule = dep.module;
|
||||
|
||||
const activeFromOtherStarExports = dep._discoverActiveExportsFromOtherStartExports();
|
||||
|
||||
if(Array.isArray(dep.originModule.usedExports)) {
|
||||
// we know which exports are used
|
||||
|
||||
|
|
@ -279,6 +281,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|||
if(id === "default") return true;
|
||||
if(dep.activeExports.has(id)) return true;
|
||||
if(importedModule.isProvided(id) === false) return true;
|
||||
if(activeFromOtherStarExports.has(id)) return true;
|
||||
return false;
|
||||
});
|
||||
if(unused) return NaN;
|
||||
|
|
@ -289,6 +292,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|||
const unused = importedModule.providedExports.every(function(id) {
|
||||
if(id === "default") return true;
|
||||
if(dep.activeExports.has(id)) return true;
|
||||
if(activeFromOtherStarExports.has(id)) return true;
|
||||
return false;
|
||||
});
|
||||
if(unused) return NaN;
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ class ConcatenatedModule extends Module {
|
|||
dependency: dep
|
||||
});
|
||||
}
|
||||
} else {
|
||||
} else if(importedModule) {
|
||||
importedModule.providedExports.forEach(name => {
|
||||
if(dep.activeExports.has(name) || name === "default")
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "webpack",
|
||||
"version": "3.6.0",
|
||||
"version": "3.7.1",
|
||||
"author": "Tobias Koppers @sokra",
|
||||
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -340,4 +340,32 @@ module.exports = some/request;`;
|
|||
hashedText.should.containEql("12345678");
|
||||
});
|
||||
});
|
||||
|
||||
describe("#updateHash without optional", function() {
|
||||
let hashedText;
|
||||
let hash;
|
||||
beforeEach(function() {
|
||||
hashedText = "";
|
||||
hash = {
|
||||
update: (text) => {
|
||||
hashedText += text;
|
||||
}
|
||||
};
|
||||
// Note no set of `externalModule.optional`, which crashed externals in 3.7.0
|
||||
externalModule.id = 12345678;
|
||||
externalModule.updateHash(hash);
|
||||
});
|
||||
it("updates hash with request", function() {
|
||||
hashedText.should.containEql("some/request");
|
||||
});
|
||||
it("updates hash with type", function() {
|
||||
hashedText.should.containEql("some-type");
|
||||
});
|
||||
it("updates hash with optional flag", function() {
|
||||
hashedText.should.containEql("false");
|
||||
});
|
||||
it("updates hash with module id", function() {
|
||||
hashedText.should.containEql("12345678");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ const Stats = require("../lib/Stats");
|
|||
|
||||
describe("Stats", () => {
|
||||
tests.forEach(testName => {
|
||||
it("should print correct stats for " + testName, (done) => {
|
||||
it("should print correct stats for " + testName, function(done) {
|
||||
this.timeout(10000);
|
||||
let options = {
|
||||
entry: "./index",
|
||||
output: {
|
||||
|
|
@ -104,7 +105,7 @@ describe("Stats", () => {
|
|||
actual.should.be.eql(expected);
|
||||
done();
|
||||
});
|
||||
}, 10000);
|
||||
});
|
||||
});
|
||||
describe("Error Handling", () => {
|
||||
describe("does have", () => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
export var test = "test";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = [
|
||||
[
|
||||
/Can't resolve '.\/missing'/
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
it("should not crash on importing missing modules", function() {
|
||||
(function() {
|
||||
require("./module");
|
||||
}).should.throw();
|
||||
});
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export * from "./missing";
|
||||
export * from "./a";
|
||||
Loading…
Reference in New Issue