-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Related: #1665
Currently, output.globals is only used if format is iife or umd. If format is es and we want to map the external module to a global variable, we usually solve it with a shim/alias plugin (e.g. export default $). However, this solution doesn't work well with experimentalCodeSplitting. When code splitting is enabled, the shim module would be chunked instead of being inlined:
entry.js
import $ from "./chunk-xxx.js";
...entry2.js
import $ from "./chunk-xxx.js";
...chunk-xxx.js
export default $;By enabling output.globals for other formats, we can avoid sharing the shim module.
Another solution is to enable code splitting for iife when there is no shared dependency (or marking all shared dependencies as externals). Related: #2072
Reactions are currently unavailable