是否有可能在RequireJS中以不同名稱使用相同的模塊? (最感興趣的優化版本)RequireJS:具有不同名稱的相同模塊
例
我取決於取決於lodash
的AMD兼容庫。我的代碼中已有underscore
,我希望該庫使用它而不是lodash
。
當然,我不想修改庫的來源。所以我修改require.js配置:
paths: {
'underscore': 'vendor/underscore', // that's for my code
...
'lodash': 'vendor/underscore', // that's for the new library
}
現在試圖建立的時候,r.js引發的不幸:
The following modules share the same URL.
This could be a misconfiguration if that URL only has one anonymous module in it:
/.../underscore.js: lodash, underscore
是否有下2個或多個註冊相同的模塊方式不同的名字?
謝謝,這工作正常,正是我正在尋找。雖然在我看來,這種配置方式有點奇怪,但這是不重要的:) –