Matt Matt - 2 months ago 21
Javascript Question

Webpack externals configuration - root key

What does it mean and what is

for in Webpack externals configuration?

module.exports = {
output: {
libraryTarget: "umd"
externals: [
"subtract": {
root: "subtract",
commonjs2: "./subtract",
commonjs: ["./math", "subtract"],
amd: "subtract"


Check the answer here:

webpack umd lib and external files

Basically it applies to UMD modules and it is used to solve global dependencies when your module is loaded using the <script> tag or well a CDN repo.