すべてのパスを追跡するために1つのpaths.jsファイルを保持する方法はありますか?
//i know you can do this where configobject.paths = require('paths');
requirejs.config(configobject)
//and r.js build config
({
paths:require('paths'),
})
すべてのパスを追跡するために1つのpaths.jsファイルを保持する方法はありますか?
//i know you can do this where configobject.paths = require('paths');
requirejs.config(configobject)
//and r.js build config
({
paths:require('paths'),
})
また、AMD モジュールのパスを一元化したいと考えていました。これは curl での実装ですが、RequireJS でも同じアプローチが機能します。
基本的に、ファイル内の設定: https://github.com/SimpleAsCouldBe/appCore/blob/master/shared/appCore/setCurlPaths.js
必要なページで構成を使用します: https://github.com/SimpleAsCouldBe/appCore/blob/master/exampleApp1/index.html
ビルド中に grunt concat などでこれを最適化できます。この共有構成ファイルについて、grunt の requirejs オプティマイザーに伝えることもできます。
# https://github.com/jrburke/r.js/blob/master/build/example.build.js
requirejs:
oneForAll:
options:
mainConfigFile: "shared/appCore/requireConfig.js"