1

reagent 0.5.0に依存するものを使用していますcljsjs/react。後者には以下が付属していますdeps.cljs

{:foreign-libs [{
 :file "cljsjs/development/react.inc.js",
 :file-min "cljsjs/production/react.min.inc.js",
 :provides ["cljsjs.react"]}],
 :externs ["cljsjs/common/react.ext.js"]}

これにより、React の JavaScript がコンパイラ出力になります。

プレーンな JavaScript ページでも React を使用したいので、これが起こらないようにしたいと思います。

また、reagent/core.cljsディレクティブ:require [cljsjs.react](To force the include?) があるため、単純に依存関係を省略することはできません。

React がコンパイラの出力で終わるのを防ぐ方法はありますか?

4

1 に答える 1

1

試薬の Readme から ( https://github.com/reagent-project/reagent ):

If you want the version of React with addons, you'd use something like this instead:

[reagent "0.5.0" :exclusions [cljsjs/react]]
[cljsjs/react-with-addons "0.12.2-4"]

If you want to use your own build of React (or React from a CDN), you have to use :exclusions variant of the dependency, and also provide a file named "cljsjs/react.cljs", containing just (ns cljsjs.react), in your project.

したがって、依存関係で :exclusions オプションを使用し、独自の cljsjs/react 名前空間と準備完了を提供するだけです。ただし、その時点で React が Reagent の前にロードされることを確認するのはあなた次第です。

于 2015-05-20T16:24:40.297 に答える