@module-federation/nextjs-mf 5.5.1 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -27
- package/{lib/client → client}/CombinedPages.d.ts +27 -28
- package/client/CombinedPages.js +38 -0
- package/client/CombinedPages.js.map +1 -0
- package/{lib/client → client}/MFClient.d.ts +72 -73
- package/client/MFClient.js +159 -0
- package/client/MFClient.js.map +1 -0
- package/{lib/client → client}/RemoteContainer.d.ts +46 -58
- package/client/RemoteContainer.js +121 -0
- package/client/RemoteContainer.js.map +1 -0
- package/{lib/client → client}/RemotePages.d.ts +49 -49
- package/client/RemotePages.js +138 -0
- package/client/RemotePages.js.map +1 -0
- package/{lib/client → client}/UrlNode.d.ts +17 -18
- package/{lib/client → client}/UrlNode.js +157 -161
- package/client/UrlNode.js.map +1 -0
- package/{lib/client → client}/helpers.d.ts +16 -17
- package/{lib/client → client}/helpers.js +90 -104
- package/client/helpers.js.map +1 -0
- package/client/index.d.ts +2 -0
- package/client/index.js +6 -0
- package/client/index.js.map +1 -0
- package/{lib/client → client}/useMFClient.d.ts +24 -25
- package/client/useMFClient.js +55 -0
- package/client/useMFClient.js.map +1 -0
- package/{lib/client → client}/useMFRemote.d.ts +16 -17
- package/client/useMFRemote.js +50 -0
- package/client/useMFRemote.js.map +1 -0
- package/jest.config.d.ts +13 -0
- package/jest.config.js +18 -0
- package/jest.config.js.map +1 -0
- package/package.json +19 -42
- package/src/include-defaults.d.ts +0 -0
- package/{lib → src}/include-defaults.js +4 -3
- package/src/include-defaults.js.map +1 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +9 -0
- package/src/index.js.map +1 -0
- package/src/internal.d.ts +12 -0
- package/src/internal.js +260 -0
- package/src/internal.js.map +1 -0
- package/src/loaders/fixImageLoader.d.ts +16 -0
- package/src/loaders/fixImageLoader.js +53 -0
- package/src/loaders/fixImageLoader.js.map +1 -0
- package/src/loaders/fixUrlLoader.d.ts +13 -0
- package/src/loaders/fixUrlLoader.js +25 -0
- package/src/loaders/fixUrlLoader.js.map +1 -0
- package/src/loaders/helpers.d.ts +10 -0
- package/src/loaders/helpers.js +46 -0
- package/src/loaders/helpers.js.map +1 -0
- package/src/loaders/nextPageMapLoader.d.ts +15 -0
- package/src/loaders/nextPageMapLoader.js +151 -0
- package/src/loaders/nextPageMapLoader.js.map +1 -0
- package/src/loaders/patchNextClientPageLoader.d.ts +7 -0
- package/src/loaders/patchNextClientPageLoader.js +43 -0
- package/src/loaders/patchNextClientPageLoader.js.map +1 -0
- package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +5 -0
- package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js +19 -0
- package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -0
- package/src/plugins/ChildFederationPlugin.d.ts +9 -0
- package/src/plugins/ChildFederationPlugin.js +281 -0
- package/src/plugins/ChildFederationPlugin.js.map +1 -0
- package/src/plugins/DevHmrFixInvalidPongPlugin.d.ts +11 -0
- package/src/plugins/DevHmrFixInvalidPongPlugin.js +55 -0
- package/src/plugins/DevHmrFixInvalidPongPlugin.js.map +1 -0
- package/src/plugins/ModuleFederationPlugin.d.ts +7 -0
- package/src/plugins/ModuleFederationPlugin.js +50 -0
- package/src/plugins/ModuleFederationPlugin.js.map +1 -0
- package/src/plugins/NextFederationPlugin.d.ts +9 -0
- package/src/plugins/NextFederationPlugin.js +111 -0
- package/src/plugins/NextFederationPlugin.js.map +1 -0
- package/src/plugins/RemoveRRRuntimePlugin.d.ts +5 -0
- package/src/plugins/RemoveRRRuntimePlugin.js +39 -0
- package/src/plugins/RemoveRRRuntimePlugin.js.map +1 -0
- package/utils/Template.d.ts +148 -0
- package/utils/Template.js +381 -0
- package/utils/Template.js.map +1 -0
- package/utils/build-utils.d.ts +3 -0
- package/utils/build-utils.js +175 -0
- package/utils/build-utils.js.map +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +7 -0
- package/utils/index.js.map +1 -0
- package/.prettierignore +0 -2
- package/.prettierrc +0 -7
- package/LICENSE +0 -21
- package/lib/ModuleFederationPlugin.js +0 -84
- package/lib/NextFederationPlugin.js +0 -513
- package/lib/_virtual/Template.js +0 -7
- package/lib/_virtual/UrlNode.js +0 -9
- package/lib/_virtual/_commonjsHelpers.js +0 -44
- package/lib/_virtual/_fast-glob.js +0 -16
- package/lib/_virtual/_fs.js +0 -16
- package/lib/_virtual/_path.js +0 -16
- package/lib/_virtual/_tslib.js +0 -277
- package/lib/_virtual/_webpack-sources.js +0 -16
- package/lib/_virtual/fs.js +0 -4
- package/lib/_virtual/fs2.js +0 -7
- package/lib/_virtual/helpers.js +0 -7
- package/lib/_virtual/nextPageMapLoader.js +0 -7
- package/lib/_virtual/options.js +0 -7
- package/lib/_virtual/utils.js +0 -7
- package/lib/build-utils.js +0 -176
- package/lib/client/CombinedPages.d.ts.map +0 -1
- package/lib/client/CombinedPages.js +0 -60
- package/lib/client/MFClient.d.ts.map +0 -1
- package/lib/client/MFClient.js +0 -213
- package/lib/client/RemoteContainer.d.ts.map +0 -1
- package/lib/client/RemoteContainer.js +0 -162
- package/lib/client/RemotePages.d.ts.map +0 -1
- package/lib/client/RemotePages.js +0 -194
- package/lib/client/UrlNode.d.ts.map +0 -1
- package/lib/client/helpers.d.ts.map +0 -1
- package/lib/client/useMFClient.d.ts.map +0 -1
- package/lib/client/useMFClient.js +0 -79
- package/lib/client/useMFRemote.d.ts.map +0 -1
- package/lib/client/useMFRemote.js +0 -72
- package/lib/dependencies/webpack/lib/Template.js +0 -437
- package/lib/dependencies/webpack/lib/container/options.js +0 -102
- package/lib/dependencies/webpack/lib/sharing/utils.js +0 -104
- package/lib/dependencies/webpack/lib/util/fs.js +0 -359
- package/lib/index.js +0 -3
- package/lib/internal.js +0 -271
- package/lib/loaders/UrlNode.js +0 -219
- package/lib/loaders/fixImageLoader.js +0 -65
- package/lib/loaders/fixUrlLoader.js +0 -25
- package/lib/loaders/helpers.js +0 -60
- package/lib/loaders/nextPageMapLoader.js +0 -200
- package/lib/loaders/patchNextClientPageLoader.js +0 -53
- package/lib/node-plugin/streaming/CommonJsChunkLoadingPlugin.js +0 -94
- package/lib/node-plugin/streaming/LoadFileChunkLoadingRuntimeModule.js +0 -414
- package/lib/node-plugin/streaming/index.js +0 -46
- package/lib/node-plugin/streaming/loadScript.js +0 -59
- package/lib/plugins/DevHmrFixInvalidPongPlugin.js +0 -82
- package/lib/utils.js +0 -125
- package/node-plugin/README.md +0 -27
- package/node-plugin/package.json +0 -4
- package/node-plugin/streaming/CommonJsChunkLoadingPlugin.js +0 -89
- package/node-plugin/streaming/LoadFileChunkLoadingRuntimeModule.js +0 -410
- package/node-plugin/streaming/NodeRuntime.js +0 -245
- package/node-plugin/streaming/index.js +0 -42
- package/node-plugin/streaming/loadScript.js +0 -51
- package/tsconfig.json +0 -33
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
require('../_virtual/_commonjsHelpers.js');
|
|
6
|
-
var nextPageMapLoader$1 = require('../_virtual/nextPageMapLoader.js');
|
|
7
|
-
require('../_virtual/_fast-glob.js');
|
|
8
|
-
require('../_virtual/_fs.js');
|
|
9
|
-
require('../_virtual/UrlNode.js');
|
|
10
|
-
var require$$0 = require('fast-glob');
|
|
11
|
-
var require$$1 = require('fs');
|
|
12
|
-
var UrlNode$1 = require('./UrlNode.js');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
17
|
-
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
18
|
-
|
|
19
|
-
const fg = require$$0__default["default"];
|
|
20
|
-
const fs = require$$1__default["default"];
|
|
21
|
-
|
|
22
|
-
// TODO: import UrlNode from ./client folder when whole project migrates on TypeScript (but right now using JS copy of this class)
|
|
23
|
-
// const UrlNode = require('../client/UrlNode').UrlNode;
|
|
24
|
-
const UrlNode = UrlNode$1["default"].UrlNode;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Webpack loader which prepares MF map for NextJS pages
|
|
28
|
-
*
|
|
29
|
-
* @type {(this: import("webpack").LoaderContext<{}>, content: string) => string>}
|
|
30
|
-
*/
|
|
31
|
-
function nextPageMapLoader() {
|
|
32
|
-
// const [pagesRoot] = getNextPagesRoot(this.rootContext);
|
|
33
|
-
// this.addContextDependency(pagesRoot);
|
|
34
|
-
const opts = this.getOptions();
|
|
35
|
-
const pages = getNextPages(this.rootContext);
|
|
36
|
-
|
|
37
|
-
let result = '';
|
|
38
|
-
if (Object.hasOwnProperty.call(opts, 'v2')) {
|
|
39
|
-
result = preparePageMapV2(pages);
|
|
40
|
-
} else {
|
|
41
|
-
result = preparePageMap(pages);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
this.callback(
|
|
45
|
-
null,
|
|
46
|
-
`module.exports = { default: ${JSON.stringify(result)} };`
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Webpack config generator for `exposes` option.
|
|
52
|
-
* - automatically create `./pages-map` module
|
|
53
|
-
* - automatically add all page modules
|
|
54
|
-
*/
|
|
55
|
-
function exposeNextjsPages(cwd) {
|
|
56
|
-
const pages = getNextPages(cwd);
|
|
57
|
-
|
|
58
|
-
const pageModulesMap = {};
|
|
59
|
-
pages.forEach((page) => {
|
|
60
|
-
// Creating a map of pages to modules
|
|
61
|
-
// './pages/storage/index': './pages/storage/index.tsx',
|
|
62
|
-
// './pages/storage/[...slug]': './pages/storage/[...slug].tsx',
|
|
63
|
-
pageModulesMap['./' + sanitizePagePath(page)] = `./${page}`;
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const exposesWithPageMap = {
|
|
67
|
-
'./pages-map': `${__filename}!${__filename}`,
|
|
68
|
-
'./pages-map-v2': `${__filename}?v2!${__filename}`,
|
|
69
|
-
...pageModulesMap,
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
return exposesWithPageMap;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function getNextPagesRoot(appRoot) {
|
|
76
|
-
let pagesDir = 'src/pages/';
|
|
77
|
-
let absPageDir = `${appRoot}/${pagesDir}`;
|
|
78
|
-
if (!fs.existsSync(absPageDir)) {
|
|
79
|
-
pagesDir = 'pages/';
|
|
80
|
-
absPageDir = `${appRoot}/${pagesDir}`;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return [absPageDir, pagesDir];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* From provided ROOT_DIR `scan` pages directory
|
|
88
|
-
* and return list of user defined pages
|
|
89
|
-
* (except special ones, like _app, _document, _error)
|
|
90
|
-
*
|
|
91
|
-
* @type {(rootDir: string) => string[]}
|
|
92
|
-
*/
|
|
93
|
-
function getNextPages(rootDir) {
|
|
94
|
-
const [cwd, pagesDir] = getNextPagesRoot(rootDir);
|
|
95
|
-
|
|
96
|
-
// scan all files in pages folder except pages/api
|
|
97
|
-
let pageList = fg.sync('**/*.{ts,tsx,js,jsx}', {
|
|
98
|
-
cwd,
|
|
99
|
-
onlyFiles: true,
|
|
100
|
-
ignore: ['api/**'],
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// remove specific nextjs pages
|
|
104
|
-
const exclude = [
|
|
105
|
-
/^_app\..*/, // _app.tsx
|
|
106
|
-
/^_document\..*/, // _document.tsx
|
|
107
|
-
/^_error\..*/, // _error.tsx
|
|
108
|
-
/^404\..*/, // 404.tsx
|
|
109
|
-
/^500\..*/, // 500.tsx
|
|
110
|
-
/^\[\.\.\..*\]\..*/, // /[...federationPage].tsx
|
|
111
|
-
];
|
|
112
|
-
pageList = pageList.filter((page) => {
|
|
113
|
-
return !exclude.some((r) => r.test(page));
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
pageList = pageList.map((page) => `${pagesDir}${page}`);
|
|
117
|
-
|
|
118
|
-
return pageList;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function sanitizePagePath(item) {
|
|
122
|
-
return item
|
|
123
|
-
.replace(/^src\/pages\//i, 'pages/')
|
|
124
|
-
.replace(/\.(ts|tsx|js|jsx)$/, '');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Create MF map from list of NextJS pages
|
|
129
|
-
*
|
|
130
|
-
* From
|
|
131
|
-
* ['pages/index.tsx', 'pages/storage/[...slug].tsx', 'pages/storage/index.tsx']
|
|
132
|
-
* Getting the following map
|
|
133
|
-
* {
|
|
134
|
-
* '/': './pages/index',
|
|
135
|
-
* '/storage/*': './pages/storage/[...slug]',
|
|
136
|
-
* '/storage': './pages/storage/index'
|
|
137
|
-
* }
|
|
138
|
-
*
|
|
139
|
-
* @type {(pages: string[]) => {[key: string]: string}}
|
|
140
|
-
*/
|
|
141
|
-
function preparePageMap(pages) {
|
|
142
|
-
const result = {};
|
|
143
|
-
|
|
144
|
-
const clearedPages = pages.map((p) => `/${sanitizePagePath(p)}`);
|
|
145
|
-
|
|
146
|
-
// getSortedRoutes @see https://github.com/vercel/next.js/blob/canary/packages/next/shared/lib/router/utils/sorted-routes.ts
|
|
147
|
-
const root = new UrlNode();
|
|
148
|
-
clearedPages.forEach((pagePath) => root.insert(pagePath));
|
|
149
|
-
// Smoosh will then sort those sublevels up to the point where you get the correct route definition priority
|
|
150
|
-
const sortedPages = root.smoosh();
|
|
151
|
-
|
|
152
|
-
sortedPages.forEach((page) => {
|
|
153
|
-
let key = page
|
|
154
|
-
.replace(/\[\.\.\.[^\]]+\]/gi, '*')
|
|
155
|
-
.replace(/\[([^\]]+)\]/gi, ':$1');
|
|
156
|
-
key = key.replace(/^\/pages\//, '/').replace(/\/index$/, '') || '/';
|
|
157
|
-
result[key] = `.${page}`;
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
return result;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Create MF list of NextJS pages
|
|
165
|
-
*
|
|
166
|
-
* From
|
|
167
|
-
* ['pages/index.tsx', 'pages/storage/[...slug].tsx', 'pages/storage/index.tsx']
|
|
168
|
-
* Getting the following map
|
|
169
|
-
* {
|
|
170
|
-
* '/': './pages/index',
|
|
171
|
-
* '/storage': './pages/storage/index'
|
|
172
|
-
* '/storage/[...slug]': './pages/storage/[...slug]',
|
|
173
|
-
* }
|
|
174
|
-
*
|
|
175
|
-
* @type {(pages: string[]) => {[key: string]: string}}
|
|
176
|
-
*/
|
|
177
|
-
function preparePageMapV2(pages) {
|
|
178
|
-
const result = {};
|
|
179
|
-
|
|
180
|
-
const clearedPages = pages.map((p) => `/${sanitizePagePath(p)}`);
|
|
181
|
-
|
|
182
|
-
// getSortedRoutes @see https://github.com/vercel/next.js/blob/canary/packages/next/shared/lib/router/utils/sorted-routes.ts
|
|
183
|
-
const root = new UrlNode();
|
|
184
|
-
clearedPages.forEach((pagePath) => root.insert(pagePath));
|
|
185
|
-
// Smoosh will then sort those sublevels up to the point where you get the correct route definition priority
|
|
186
|
-
const sortedPages = root.smoosh();
|
|
187
|
-
|
|
188
|
-
sortedPages.forEach((page) => {
|
|
189
|
-
let key = page.replace(/^\/pages\//, '/').replace(/\/index$/, '') || '/';
|
|
190
|
-
result[key] = `.${page}`;
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
return result;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
nextPageMapLoader$1.nextPageMapLoader.exports = nextPageMapLoader;
|
|
197
|
-
var exposeNextjsPages_1 = nextPageMapLoader$1.nextPageMapLoader.exports.exposeNextjsPages = exposeNextjsPages;
|
|
198
|
-
|
|
199
|
-
exports["default"] = nextPageMapLoader$1.nextPageMapLoader.exports;
|
|
200
|
-
exports.exposeNextjsPages = exposeNextjsPages_1;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This webpack loader patches next/dist/client/page-loader.js file.
|
|
5
|
-
* Also it requires `include-defaults.js` with required shared libs
|
|
6
|
-
*
|
|
7
|
-
* @type {(this: import("webpack").LoaderContext<{}>, content: string) => string>}
|
|
8
|
-
*/
|
|
9
|
-
function patchNextClientPageLoader(content) {
|
|
10
|
-
if (content.includes('MFClient')) {
|
|
11
|
-
// If MFClient already applied then skip patch
|
|
12
|
-
return content;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// avoid absolute paths as they break hashing when the root for the project is moved
|
|
16
|
-
// @see https://webpack.js.org/contribute/writing-a-loader/#absolute-paths
|
|
17
|
-
const pathIncludeDefaults = path.relative(
|
|
18
|
-
this.context,
|
|
19
|
-
path.resolve(__dirname, '../include-defaults.js')
|
|
20
|
-
);
|
|
21
|
-
const pathMFClient = path.relative(
|
|
22
|
-
this.context,
|
|
23
|
-
path.resolve(__dirname, '../client/MFClient.js')
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
patchedContent = content.replace(
|
|
27
|
-
'exports.default = PageLoader;',
|
|
28
|
-
`
|
|
29
|
-
require(${JSON.stringify(pathIncludeDefaults)});
|
|
30
|
-
const MFClient = require(${JSON.stringify(pathMFClient)}).MFClient;
|
|
31
|
-
|
|
32
|
-
class PageLoaderExtended extends PageLoader {
|
|
33
|
-
constructor(buildId, assetPrefix) {
|
|
34
|
-
super(buildId, assetPrefix);
|
|
35
|
-
global.mf_client = new MFClient(this, { mode: process.env.NODE_ENV });
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
_getPageListOriginal() {
|
|
39
|
-
return super.getPageList();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
getPageList() {
|
|
43
|
-
return global.mf_client.getPageList();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.default = PageLoaderExtended;
|
|
47
|
-
`
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
return patchedContent;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
module.exports = patchNextClientPageLoader;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var LoadFileChunkLoadingRuntimeModule = require('./LoadFileChunkLoadingRuntimeModule.js');
|
|
6
|
-
|
|
7
|
-
const RuntimeGlobals = require('webpack/lib/RuntimeGlobals');
|
|
8
|
-
const StartupChunkDependenciesPlugin = require('webpack/lib/runtime/StartupChunkDependenciesPlugin');
|
|
9
|
-
// const ChunkLoadingRuntimeModule = require('webpack/lib/node/ReadFileChunkLoadingRuntimeModule')
|
|
10
|
-
class CommonJsChunkLoadingPlugin {
|
|
11
|
-
constructor(options) {
|
|
12
|
-
this.options = options || {};
|
|
13
|
-
this._asyncChunkLoading = this.options.asyncChunkLoading;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Apply the plugin
|
|
18
|
-
* @param {Compiler} compiler the compiler instance
|
|
19
|
-
* @returns {void}
|
|
20
|
-
*/
|
|
21
|
-
apply(compiler) {
|
|
22
|
-
const chunkLoadingValue = this._asyncChunkLoading
|
|
23
|
-
? 'async-node'
|
|
24
|
-
: 'require';
|
|
25
|
-
new StartupChunkDependenciesPlugin({
|
|
26
|
-
chunkLoading: chunkLoadingValue,
|
|
27
|
-
asyncChunkLoading: this._asyncChunkLoading,
|
|
28
|
-
}).apply(compiler);
|
|
29
|
-
compiler.hooks.thisCompilation.tap(
|
|
30
|
-
'CommonJsChunkLoadingPlugin',
|
|
31
|
-
(compilation) => {
|
|
32
|
-
// Always enabled
|
|
33
|
-
const isEnabledForChunk = () => true;
|
|
34
|
-
const onceForChunkSet = new WeakSet();
|
|
35
|
-
const handler = (chunk, set) => {
|
|
36
|
-
if (onceForChunkSet.has(chunk)) return;
|
|
37
|
-
onceForChunkSet.add(chunk);
|
|
38
|
-
if (!isEnabledForChunk(chunk)) return;
|
|
39
|
-
set.add(RuntimeGlobals.moduleFactoriesAddOnly);
|
|
40
|
-
set.add(RuntimeGlobals.hasOwnProperty);
|
|
41
|
-
compilation.addRuntimeModule(
|
|
42
|
-
chunk,
|
|
43
|
-
new LoadFileChunkLoadingRuntimeModule["default"](set, this.options, {
|
|
44
|
-
webpack: compiler.webpack,
|
|
45
|
-
})
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
compilation.hooks.runtimeRequirementInTree
|
|
50
|
-
.for(RuntimeGlobals.ensureChunkHandlers)
|
|
51
|
-
.tap('CommonJsChunkLoadingPlugin', handler);
|
|
52
|
-
compilation.hooks.runtimeRequirementInTree
|
|
53
|
-
.for(RuntimeGlobals.hmrDownloadUpdateHandlers)
|
|
54
|
-
.tap('CommonJsChunkLoadingPlugin', handler);
|
|
55
|
-
compilation.hooks.runtimeRequirementInTree
|
|
56
|
-
.for(RuntimeGlobals.hmrDownloadManifest)
|
|
57
|
-
.tap('CommonJsChunkLoadingPlugin', handler);
|
|
58
|
-
compilation.hooks.runtimeRequirementInTree
|
|
59
|
-
.for(RuntimeGlobals.baseURI)
|
|
60
|
-
.tap('CommonJsChunkLoadingPlugin', handler);
|
|
61
|
-
compilation.hooks.runtimeRequirementInTree
|
|
62
|
-
.for(RuntimeGlobals.externalInstallChunk)
|
|
63
|
-
.tap('CommonJsChunkLoadingPlugin', handler);
|
|
64
|
-
compilation.hooks.runtimeRequirementInTree
|
|
65
|
-
.for(RuntimeGlobals.onChunksLoaded)
|
|
66
|
-
.tap('CommonJsChunkLoadingPlugin', handler);
|
|
67
|
-
|
|
68
|
-
compilation.hooks.runtimeRequirementInTree
|
|
69
|
-
.for(RuntimeGlobals.ensureChunkHandlers)
|
|
70
|
-
.tap('CommonJsChunkLoadingPlugin', (chunk, set) => {
|
|
71
|
-
if (!isEnabledForChunk(chunk)) return;
|
|
72
|
-
set.add(RuntimeGlobals.getChunkScriptFilename);
|
|
73
|
-
});
|
|
74
|
-
compilation.hooks.runtimeRequirementInTree
|
|
75
|
-
.for(RuntimeGlobals.hmrDownloadUpdateHandlers)
|
|
76
|
-
.tap('CommonJsChunkLoadingPlugin', (chunk, set) => {
|
|
77
|
-
if (!isEnabledForChunk(chunk)) return;
|
|
78
|
-
set.add(RuntimeGlobals.getChunkUpdateScriptFilename);
|
|
79
|
-
set.add(RuntimeGlobals.moduleCache);
|
|
80
|
-
set.add(RuntimeGlobals.hmrModuleData);
|
|
81
|
-
set.add(RuntimeGlobals.moduleFactoriesAddOnly);
|
|
82
|
-
});
|
|
83
|
-
compilation.hooks.runtimeRequirementInTree
|
|
84
|
-
.for(RuntimeGlobals.hmrDownloadManifest)
|
|
85
|
-
.tap('CommonJsChunkLoadingPlugin', (chunk, set) => {
|
|
86
|
-
if (!isEnabledForChunk(chunk)) return;
|
|
87
|
-
set.add(RuntimeGlobals.getUpdateManifestFilename);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
exports["default"] = CommonJsChunkLoadingPlugin;
|