0

すべてのパスを追跡するために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'),
})
4

1 に答える 1

0

また、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"
于 2013-10-27T02:02:46.320 に答える