【问题标题】:Difference between exlude and excludeShallow in r.jsr.js 中排除和排除 Shallow 的区别
【发布时间】:2015-09-29 10:21:57
【问题描述】:

r.js 中的exlude 和excludeShallow 有什么区别为什么要用。

【问题讨论】:

    标签: node.js r.js


    【解决方案1】:

    The r.js example build file 通过示例解释了 exclude 和 excludeShallow 之间的区别,其中 excludeShallow 通常在开发过程中会有所帮助。

    //This module entry combines all the dependencies of foo/bar/bip into one file,
    //but excludes foo/bar/bop and its dependencies from the built file. If you want
    //to exclude a module that is also another module being optimized, it is more
    //efficient if you define that module optimization entry before using it
    //in an exclude array.
    {
        name: "foo/bar/bip",
        exclude: [
            "foo/bar/bop"
        ]
    },
    
    //This module entry shows how to specify a specific module be excluded
    //from the built module file. excludeShallow means just exclude that
    //specific module, but if that module has nested dependencies that are
    //part of the built file, keep them in there. This is useful during
    //development when you want to have a fast bundled set of modules, but
    //just develop/debug one or two modules at a time.
    {
        name: "foo/bar/bin",
        excludeShallow: [
            "foo/bar/bot"
        ]
    },
    

    The r.js documentation 进一步解释了 excludeShallow 可能对快速开发有用:通过命令行使用优化器时,excludeShallow 选项可用于排除模块的优化。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-15
      • 1970-01-01
      • 2022-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-22
      相关资源
      最近更新 更多