react-native 打包成web项目用于微信公众号,以及问题汇总
来源:互联网 发布:淘宝客后台管理系统 编辑:程序博客网 时间:2024/06/05 07:49
https://github.com/taobaofed/react-web#fix-platform-differences
如果打包成功,可以作为公众号的自定义菜单项目。
以下是自己在按照上面链接的步骤运行时候遇到的问题
问题汇总:
1.Cannot resolve module 'react/lib/ReactMount'
原因:好像是在react 14.x 版本之后,ReactMount从react中分离了,挪到react-dom模块了,而如果引用了react-hot-loader v1就会报这个错,因为他依赖的是老版本的react
解决:在使用高版本的react后需要使用react-hot-loader V3.X版本的,我是用的是
"react-hot-loader": "3.0.0-beta.6"
我的package.json内容如下:
{ "name": "firstReactWeb", "version": "0.0.1", "private": true, "dependencies": { "react-web": "0.4.6" }, "devDependencies": { "react": "^15.4.2", "babel-loader": "^6.2.5", "babel-preset-react-native": "^1.9.0", "babel-preset-stage-1": "^6.16.0", "haste-resolver-webpack-plugin": "^0.2.2", "json-loader": "^0.5.4", "webpack": "^1.13.2", "webpack-dev-server": "^1.16.1", "webpack-html-plugin": "^0.1.1", "react-dom":"15.3", "react-hot-loader": "3.0.0-beta.6" }}
2.React Hot Loader: The Webpack loader is now exported separately. If you use Babel, we recommend that you remove "react-hot-loader" from the "loaders" section of your Webpack configuration altogether, and instead add "react-hot-loader/babel" to the "plugins" section of your .babelrc file. If you prefer not to use Babel, replace "react-hot-loader" or "react-hot" with "react-hot-loader/webpack" in the "loaders" section of your Webp
ack configuration.出现提示loader选择,使用baber或者hot-loader,我是用的是hot-loader,以下是解决方法
解决:修改webpack-config.js文件module里面的loader,注释掉以下部分,添加新的
module: { loaders: [{ test: /\.json$/, loader: 'json', }, {//开始******************************************** test: /\.jsx?$/, loader: 'react-hot-loader/webpack', include: [config.paths.src], exclude: [/node_modules/] }//结束*********************************************** /*, { test: /\.jsx?$/, loader: 'react-hot', include: [config.paths.src], exclude: [/node_modules/] }, { test: /\.jsx?$/, loader: 'babel', query: { presets: ['react-native', 'stage-1'] }, include: [config.paths.src], exclude: [path.sep === '/' ? /(node_modules\/(?!react-))/ : /(node_modules\\(?!react-))/] }*/] }
阅读全文
1 0
- react-native 打包成web项目用于微信公众号,以及问题汇总
- React-native 问题汇总
- React Native 问题汇总
- React Native之项目打包
- React Native之项目打包
- 微信公众号运营辅助工具汇总
- 微信公众号开发工具汇总
- React Native打包成APK
- React-Native 项目打包(iOS/Android)
- 关于React Native打包安卓项目
- 【转】react-native-微信支付问题总结
- React native 开发遇到的问题汇总
- React Native 适配问题汇总
- React Native 适配问题汇总续
- react native 配置方面的问题汇总
- 【React Native开发】React Native进行签名打包成Apk
- 【React Native开发】React Native进行签名打包成Apk
- react-native项目跑在web上(react-web)
- 如何在局域网中将Ubuntu文件夹共享给Windows
- 乒乓球问题 c语言 90分 没通过 知道答案者留下
- rabbitmq之Java-channel
- ubuntu16.04安装wps以及字体找不到的解决方案
- Maven 创建SpringMVC记录
- react-native 打包成web项目用于微信公众号,以及问题汇总
- html div左右/垂直居中
- 写优雅代码之聊一聊接口2
- Java并发编程:线程池的使用
- Java多线程(一)基本概念
- 学习笔记5
- HDU6124 Euler theorem 签到
- C++对象的动态建立与释放详解(new和delete)
- 顺序表-查