私がしたいことは、あるプロジェクトでは反応ネイティブと反応の両方を使用できるため、package.jsonのアイデアが必要です、 はここに私のpackage.jsonです:1つのパッケージ内でreact、react-domとreact-nativeのバージョンが一致します.json
{
"name": "reactNativeWeb",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"create-ios-bundle": "react-native bundle --entry-file index.ios.js --bundle-output ./bundle/bundle_iOS/index.ios.bundle --platform ios --assets-dest ./bundle/bundle_iOS --dev false",
"create-android-bundle": "react-native bundle --entry-file index.android.js --bundle-output ./bundle/bundle_android/index.android.bundle --platform android --assets-dest ./bundle/bundle_android --dev false",
"web-dev": "webpack-dev-server --config web/config/webpack.config.dev.js --inline --hot --colors",
"web-prod": "webpack --config web/config/webpack.config.prod.js --progress --colors",
"test": "jest"
},
"dependencies": {
"react": "15.5.4",
"react-dom": "15.5.4",
"react-native": "0.46.0"
},
"devDependencies": {
"babel-preset-es2015": "6.24.1",
"babel-preset-react-native": "2.0.0",
"autoprefixer": "7.1.2",
"babel-core": "6.25.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.1",
"babel-preset-react-app": "^3.0.2",
"babel-runtime": "6.26.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"css-loader": "0.28.4",
"dotenv": "4.0.0",
"eslint": "4.4.1",
"eslint-config-react-app": "^2.0.0",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.35.0",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.1.0",
"extract-text-webpack-plugin": "3.0.0",
"file-loader": "0.11.2",
"fs-extra": "3.0.1",
"fsevents": "1.1.2",
"html-webpack-plugin": "2.29.0",
"jest": "20.0.4",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.6",
"promise": "8.0.1",
"react-dev-utils": "^4.0.1",
"style-loader": "0.18.2",
"sw-precache-webpack-plugin": "0.11.4",
"url-loader": "0.5.9",
"webpack": "3.5.1",
"webpack-dev-server": "2.7.1",
"webpack-manifest-plugin": "1.2.1",
"whatwg-fetch": "2.0.3"
}
}
と、この構成はreact.js正常に実行することができ、それが反応し、ネイティブに実行することはできませんので、ネイティブ反応し16.0のバージョンを反応させる必要があるため、私は、助けを必要としています。 0-alpha12ですが、react-domはこのバージョンに依存していませんが、どのようにすれば適切な設定を見つけることができますか?
ご協力ありがとうございます。
一つのプロジェクトと1つのpackage.json、両方の反応ネイティブアプリを実行し、Webアプリケーションを反応させ、使用NPMの実行ウェブ-devを使ってWebアプリケーションを起動し、npm startを使用して反応ネイティブアプリを実行しますが、今度は反応DOMと反応ネイティブの間に競合があります。なぜなら、異なるバージョンの反応に依存しているからです。 –
私はあなたがなぜそのようなことをしているかもしれませんが、webappやmobileのようなフォルダとnode_modulesフォルダを別々に分けることができます。 – bennygenel