我正在尝试使用 requirejs 优化器,但出现以下错误:
从节点运行:
$ node r.js js/main.js -o build.js
Error: Evaluating js/app/main.js as module "app/main" failed with error:
Error: Evaluating js/lib/jquery-1.8.0.js as module "jquery" failed
with error: ReferenceError: window is not defined
从java运行
$ java -classpath js/lib/dist/js.jar:js/lib/dist/compiler.jar org.mozilla.javascript.tools.shell.Main r.js js/main.js
js: uncaught JavaScript runtime exception: ReferenceError: "window" is not defined.
js: uncaught JavaScript runtime exception: ReferenceError: "window" is not defined.
js: uncaught JavaScript runtime exception: ReferenceError: "window" is not defined.
我想我应该以某种方式告诉编译器源应该从网络浏览器运行(只是猜测)......