我遵循了http://requirejs.org/docs/optimization.html中描述的示例文件结构并得到了一个工作版本。然后我将 two.js 修改为如下所示:
define(["xstyle/css!app/css/main.css"], function () {
console.log("two");
});
并将 xstyle/css 添加到 build.js 中:
({
baseUrl: "./scripts",
paths: {
dojo: "empty:",
xstyle: "empty:"
},
name: "main",
out: "main-built.js"
})
添加再次运行构建:
r.js.cmd -o build.js 优化=无
现在我看到了这个错误:
Tracing dependencies for: main
TypeError: Cannot read property 'normalize' of undefined
In module tree:
main
two
Error: TypeError: Cannot read property 'normalize' of undefined
In module tree:
main
two
at Object.<anonymous> (bin\r.js:1187:35)
有很多引用相同的错误,但没有解决这个特定问题(例如):
https://github.com/odoe/AGSModularDemo
是否可以使用 requirejs 优化 dojo 应用程序?