0

这是一个理论问题。

RequireJS 如何与具有目录结构的 Joomla 等系统一起使用(包括包含来自组件、插件等的脚本的能力)

/components/com_something/script/a.js
/components/com_other/script/b.js

还是RequireJS不适合这种多层目录结构?

4

1 回答 1

3

您可以使用路径配置:

require.config({
  baseUrl: '/components'
  paths: {
    something: 'com_something/script',
    other: 'com_other/script'
  }
});

require(['something/a', 'other/b'], function(a, b){
  // ...
});
于 2011-11-05T07:26:48.647 回答