mirror of https://github.com/webpack/webpack.git
test and fix persistent caching
This commit is contained in:
parent
e78a76b2e0
commit
cbb7ffc94d
|
@ -24,6 +24,19 @@ class FallbackDependency extends Dependency {
|
|||
get type() {
|
||||
return "fallbacks";
|
||||
}
|
||||
|
||||
serialize(context) {
|
||||
const { write } = context;
|
||||
write(this.requests);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
static deserialize(context) {
|
||||
const { read } = context;
|
||||
const obj = new FallbackDependency(read());
|
||||
obj.deserialize(context);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
makeSerializable(
|
||||
|
|
|
@ -175,12 +175,12 @@ class ConsumeSharedPlugin {
|
|||
}
|
||||
const match = unresolvedConsumes.get(request);
|
||||
if (match !== undefined) {
|
||||
return new ConsumeSharedModule(context, match);
|
||||
return new ConsumeSharedModule(compiler.context, match);
|
||||
}
|
||||
for (const [prefix, options] of prefixConsumes) {
|
||||
if (request.startsWith(prefix)) {
|
||||
const remainder = request.slice(prefix.length);
|
||||
return new ConsumeSharedModule(context, {
|
||||
return new ConsumeSharedModule(compiler.context, {
|
||||
...options,
|
||||
import: options.import
|
||||
? options.import + remainder
|
||||
|
@ -202,7 +202,7 @@ class ConsumeSharedPlugin {
|
|||
}
|
||||
const options = resolvedConsumes.get(createData.resource);
|
||||
if (options !== undefined) {
|
||||
return new ConsumeSharedModule(context, options);
|
||||
return new ConsumeSharedModule(compiler.context, options);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -54,6 +54,8 @@ describe("Persistent Caching", () => {
|
|||
return new Promise((resolve, reject) => {
|
||||
webpack({ ...config, ...configAdditions }, (err, stats) => {
|
||||
if (err) return reject(err);
|
||||
if (stats.hasErrors())
|
||||
return reject(stats.toString({ preset: "errors-only" }));
|
||||
resolve(stats);
|
||||
});
|
||||
});
|
||||
|
@ -138,7 +140,8 @@ export default ${files.map((_, i) => `f${i}`).join(" + ")};
|
|||
const data = {
|
||||
"index.js":
|
||||
"export default import('container/src/exposed').then(m => m.default);",
|
||||
"exposed.js": "export default 42;"
|
||||
"exposed.js": "import lib from 'lib'; export default 21 + lib;",
|
||||
"lib.js": "export default 21"
|
||||
};
|
||||
await updateSrc(data);
|
||||
const configAdditions = {
|
||||
|
@ -148,7 +151,15 @@ export default ${files.map((_, i) => `f${i}`).join(" + ")};
|
|||
library: { type: "commonjs-module" },
|
||||
exposes: ["./src/exposed"],
|
||||
remotes: {
|
||||
container: "./container"
|
||||
container: ["./no-container", "./container"]
|
||||
},
|
||||
shared: {
|
||||
lib: {
|
||||
import: "./src/lib",
|
||||
shareKey: "lib",
|
||||
version: "1.2.3",
|
||||
requiredVersion: "^1.0.0"
|
||||
}
|
||||
}
|
||||
})
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue