English 中文(简体)
正在装入有需要的基准模型。 config
原标题:Loading basemodel with require.config

我有一个可以扩展 Backbone 的模型。 模式并将其用于我所有的模型中。 我想把它包含在要求中. config. paths 中, 这样在每个模块中我就可以定义( [强调, 骨干, 基模 ), 功能(... ) 。 但是, 要求无法装入它 。

我检查了所有路径, 当我在我的定义函数... 模型/混ixins/ base model 内给文件一个直接路径时, 我检查了所有路径, 它就起作用了 。

难道不可能在路径内包括一个模块吗?

问题回答

如果它不起作用, 您是否设置了您的路径 需要. config? 至少您必须设置基本URL 字段 :

require.config({
    baseUrl: /js/ ,
    paths:{
        text: lib/3rdparty/text 
    }
});

如果您有长路, 您可以设置别名路径 。





相关问题
How to handle circular dependencies with RequireJS/AMD?

In my system, I have a number of "classes" loaded in the browser each a separate files during development, and concatenated together for production. As they are loaded, they initialize a property on a ...

RequireJS - Loading an already loaded module

I am trying to use RequireJS to load browser modules and I came into an interesting problem. I have 3 modules named a, b and c having these simple source code: a.js define([ ./b , ./c ], function(...

Understanding when and how to use Require.JS

I ve just begun to work with Require.JS and I m a bit unclear on the appropriate cases in which it should be used, as well as the correct way to use it in those cases. Here s how I currently have ...

RequireJS traditional script loading aka Order Plugin

I have been beating my head against this for quite a while. I m loading about 60 script files that need to respect a certain dependency structure. Loading these normally in requirejs does not work, ...

热门标签