feat: refactoring project
This commit is contained in:
10
node_modules/webpack/lib/container/ContainerPlugin.js
generated
vendored
10
node_modules/webpack/lib/container/ContainerPlugin.js
generated
vendored
@@ -6,6 +6,7 @@
|
||||
"use strict";
|
||||
|
||||
const createSchemaValidation = require("../util/create-schema-validation");
|
||||
const memoize = require("../util/memoize");
|
||||
const ContainerEntryDependency = require("./ContainerEntryDependency");
|
||||
const ContainerEntryModuleFactory = require("./ContainerEntryModuleFactory");
|
||||
const ContainerExposedDependency = require("./ContainerExposedDependency");
|
||||
@@ -16,6 +17,10 @@ const { parseOptions } = require("./options");
|
||||
/** @typedef {import("./ContainerEntryModule").ExposeOptions} ExposeOptions */
|
||||
/** @typedef {import("./ContainerEntryModule").ExposesList} ExposesList */
|
||||
|
||||
const getModuleFederationPlugin = memoize(() =>
|
||||
require("./ModuleFederationPlugin")
|
||||
);
|
||||
|
||||
const validate = createSchemaValidation(
|
||||
require("../../schemas/plugins/container/ContainerPlugin.check.js"),
|
||||
() => require("../../schemas/plugins/container/ContainerPlugin.json"),
|
||||
@@ -73,10 +78,12 @@ class ContainerPlugin {
|
||||
}
|
||||
|
||||
compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {
|
||||
const hooks =
|
||||
getModuleFederationPlugin().getCompilationHooks(compilation);
|
||||
const dep = new ContainerEntryDependency(name, exposes, shareScope);
|
||||
dep.loc = { name };
|
||||
compilation.addEntry(
|
||||
compilation.options.context,
|
||||
/** @type {string} */ (compilation.options.context),
|
||||
dep,
|
||||
{
|
||||
name,
|
||||
@@ -86,6 +93,7 @@ class ContainerPlugin {
|
||||
},
|
||||
error => {
|
||||
if (error) return callback(error);
|
||||
hooks.addContainerEntryDependency.call(dep);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user