Webpack externals configuration - root key

1.1k Views Asked by At

What does it mean and what is root for in Webpack externals configuration?

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

There are 1 best solutions below

0
On BEST ANSWER

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.