鲍尔&x2B;RequireJS多个文件

鲍尔&x2B;RequireJS多个文件,requirejs,bower,Requirejs,Bower,我有一个包含2个requirejs模块的bower包- - src - a.js <- this is the primary package/amd module which lists b.js as a module dependency - b.js 问题是,当我将此包作为独立项目的依赖项添加时,require.js配置只会成功解析模块a的路径 维护由多个rjs模块组成的bower软件包的最佳解决方案是什么,而无需在父项目中手动配置rjs软件包密钥 我希望能够成功地从bowe

我有一个包含2个requirejs模块的bower包-

- src
 - a.js <- this is the primary package/amd module which lists b.js as a module dependency
 - b.js
问题是,当我将此包作为独立项目的依赖项添加时,require.js配置只会成功解析模块a的路径

维护由多个rjs模块组成的bower软件包的最佳解决方案是什么,而无需在父项目中手动配置rjs
软件包
密钥

我希望能够成功地从bower.json自动构建我的rjs配置,就像grunt bower和其他npm构建模块一样

我的一部分感觉这是bowers的责任,因为应该有一个选项将包定义为多个文件


我还怀疑可能有一种方法可以将模块连接到一个文件中,但我有点不确定如何做到这一点。

我找到了答案。解决方案包括将所述文件连接成一个bower包

// This will build all 3 files into a single concatenated pkg
// 'efficient-frontier', 'everestjs', 'sem-campaign'
// nmp install -g rjs
// r.js -o require.build.js optimize=none
// Below is a file in my root named 'require.build.js'
({
    baseUrl: "",
    paths: {
      everestjs: './vendor/bower/everestjs/index',
      requirejs: './vendor/bower/requirejs/require',
      'jquery.cookie': './vendor/bower/jquery.cookie/jquery.cookie',
      'sem-campaign': 'dist/shared/sem-campaign',
      'efficient-frontier': 'dist/shared/efficient-frontier',
      jquery: './vendor/bower/jquery/jquery'
    },
    // Exclude the packages you expect to be included in the parent project
    exclude: ['jquery','jquery.cookie'],
    name: "sem-campaign",
    out: "./dist/sem-campaign.js"
})
最后一个包bower是3个串联的rjs模块。本例中的包是sem活动

// This will build all 3 files into a single concatenated pkg
// 'efficient-frontier', 'everestjs', 'sem-campaign'
// nmp install -g rjs
// r.js -o require.build.js optimize=none
// Below is a file in my root named 'require.build.js'
({
    baseUrl: "",
    paths: {
      everestjs: './vendor/bower/everestjs/index',
      requirejs: './vendor/bower/requirejs/require',
      'jquery.cookie': './vendor/bower/jquery.cookie/jquery.cookie',
      'sem-campaign': 'dist/shared/sem-campaign',
      'efficient-frontier': 'dist/shared/efficient-frontier',
      jquery: './vendor/bower/jquery/jquery'
    },
    // Exclude the packages you expect to be included in the parent project
    exclude: ['jquery','jquery.cookie'],
    name: "sem-campaign",
    out: "./dist/sem-campaign.js"
})