You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5f6f270
Browse filesBrowse the repository at this point in the historyBrowse files
feat(entry): add entry.mergeExports to expose every entry module's exports
An entry with several modules in `import` exports only the last one's,
so a `library` build silently drops the rest and tree shaking removes
them in production (#15936). Making that the default would break a
contract webpack has kept since 4, so merging is opt-in per entry.
`__webpack_require__.me` merges the entry namespaces in order, later
modules winning a conflicting name, and `ModuleLibraryPlugin` widens its
`export {}` clause to their union. Entry modules that run behind a chunk
load cannot be read back, so those configurations error instead of
falling back silently.
Copy file name to clipboardExpand all lines: declarations/WebpackOptions.d.ts
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -202,6 +202,11 @@ export type UmdAmdContainer = string;
202
202
* If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.
203
203
*/
204
204
exporttypeUmdNamedDefine=boolean;
205
+
/**
206
+
* Expose the exports of every module in 'import' instead of only the last one's. Modules are merged in order, so a later one wins a conflicting export name. Only observable through 'output.library'.
207
+
* @since 5.111.0
208
+
*/
209
+
exporttypeEntryMergeExports=boolean;
205
210
/**
206
211
* The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
* Expose the exports of every module in 'import' instead of only the last one's. Modules are merged in order, so a later one wins a conflicting export name. Only observable through 'output.library'.
1393
+
*/
1394
+
mergeExports?: EntryMergeExports;
1386
1395
/**
1387
1396
* The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
* Expose the exports of every module in 'import' instead of only the last one's. Modules are merged in order, so a later one wins a conflicting export name. Only observable through 'output.library'.
4547
+
*/
4548
+
mergeExports?: EntryMergeExports;
4536
4549
/**
4537
4550
* The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
MIT License http://www.opensource.org/licenses/mit-license.php
3
+
Author Alexander Akait @alexander-akait
4
+
*/
5
+
6
+
"use strict";
7
+
8
+
constWebpackError=require("./WebpackError");
9
+
10
+
/** @import Chunk from "../Chunk" */
11
+
12
+
/**
13
+
* Error raised when an entry asks for `mergeExports` but its modules do not all
14
+
* run during the chunk's own startup, so their exports cannot be merged.
* Captures the chunk whose entry modules run behind a chunk load.
19
+
* @param {Chunk} chunk the chunk carrying the entry
20
+
*/
21
+
constructor(chunk){
22
+
super(
23
+
`Entry "${chunk.name||chunk.id}" can't merge the exports of its modules because they don't all run when this chunk starts up. Remove 'mergeExports', or remove the 'dependOn'/runtime splitting that defers them.`
0 commit comments