如果我在沒有「namespace:'foo'」標誌的情況下運行優化器,那麼一切都按預期工作。當我添加「命名空間:‘富’」到app.build.js我得到這個錯誤:RequireJS + jQuery命名空間問題
GET: file:// (path to the project) /require-jquery/jquery-require-sample/webapp/jquery.js
main-built.js:main-built.js:1839Uncaught Error: Script error http://requirejs.org/docs/errors.html#scripterror
main-built.js:163
我已經看了看周圍的解決方案,但有使用RequireJS優化導出單個文件一點信息,使用jQuery和命名空間。謝謝!
我已經把RequireJS + jQuery的樣本項目(具有修改app.build.js和app.html)on github here.
({
baseUrl: ".",
out: 'main-built.js',
//Comment out the optimize line if you want
//the code minified by UglifyJS
optimize: "none",
paths: {
"jquery": "require-jquery"
},
name: 'main',
namespace: 'foo'
})