简体   繁体   中英

Webpack externals configuration - root key

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"
            }
        }
    ]
} 

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM