将appDir条目添加到requirejs优化器构建文件结果错误

时间:2012-12-04 23:03:12

标签: requirejs

当我在构建文件中添加appDir条目时,我得到以下错误。

C:\Users\Thupten\Development\experiments>node r.js -o build.js
    TypeError: Cannot read property 'length' of undefined
        at Function.build.makeAbsPath (C:\Users\Thupten\Development\experiments\r.js:22452:51)

这是我的构建文件

({
    appDir:"./SimpleRequireJsProject",
    baseUrl: "scripts",
    mainConfigFile: './SimpleRequireJsProject/scripts/main.js',
    include:'entrance.js',  //relative to baseUrl
    name:"main",
    out:"main-built.js",
    optimize:"none"
    })

我做错了什么?

1 个答案:

答案 0 :(得分:1)

已解决,appDir选项与out选项不兼容,请改用dir选项。例如:

({
  appDir: '.',
  baseUrl: 'lib',
  dir: '../demo-build'
})