dojo 配置是否支持 requirejs 包

does dojo config support requirejs bundles

dojo 配置是否支持 requirejs bundles

Introduced in RequireJS 2.1.10: allows configuring multiple module IDs to be found in another script. Example:

requirejs.config({
    bundles: {
        'primary': ['main', 'util', 'text', 'text!template.html'],
        'secondary': ['text!secondary.html']
    }
});

require(['util', 'text'], function(util, text) {
    //The script for module ID 'primary' was loaded,
    //and that script included the define()'d
    //modules for 'util' and 'text'
});

That config states: modules 'main', 'util', 'text' and 'text!template.html' will be found by loading module ID 'primary'. Module 'text!secondary.html' can be found by loading module ID 'secondary'.

在 Dojo 1.8 中,模块被转换为 AMD 格式,但是 dojo 使用了一些 "special loader plugins" 仍处于草案阶段并且可能与 RequireJS 不完全兼容。在 RequireJS 文档中,建议改用 Dojo 的 AMD 加载器。

来自 Dojod 错误跟踪器的相关文档 ticket 15616

请注意,如果您需要 "build" 您的 dojo 应用程序,您应该使用 dojo utilapp.profile.js,您可以在其中指定 "bundle" 的模块列表.

我建议看看这个 dojo 样板作为您的 dojo 构建配置的起点:https://github.com/csnover/dojo-boilerplate

有关 dojo 构建的有用资源也可以在这里找到:https://dojotoolkit.org/reference-guide/1.10/build/