jinjiaxing / react-template-easily Goto Github PK
View Code? Open in Web Editor NEW简单易用的react工程化模板,适用于h5,webapp,hybrid开发
Home Page: https://jinjiaxing.github.io/react-template-easily/
License: MIT License
简单易用的react工程化模板,适用于h5,webapp,hybrid开发
Home Page: https://jinjiaxing.github.io/react-template-easily/
License: MIT License
打开package.json 没看到你有设置mock 这个命令啊,你是怎么运行的
1:安装,preact
preact-compat
preact-redux
npm install preact preact-compat --save-dev
npm install preact-redux --save-dev
2:preact-compat的作用是让我们简单转换升级,只需简单修改代码适配即可
3: 设置 preact-compat 的 Alias,在webpack文件中:
resolve: {
alias: {
// 'react': path.join(__dirname, 'node_modules', 'react')
"react": "preact-compat",
"react-dom": "preact-compat",
// 如果代码使用了createClass,则加入下面
'create-react-class': 'preact-compat/lib/create-react-class'
},
},
4:安装其他对应preact插件
npm install preact-tap-event-plugin --save-dev
(如果之前使用react-tap-event-plugin 则需要,没使用则不需要)
5:一键替换,只需要对应脚本即可
"dev": "NODE_ENV='dev' webpack-dev-server --config webpack.dev.config.js --watch --inline --compress --progress --colors --env development",
"dev:preact": "NODE_ENV='dev' REACT_ENV='preact' webpack-dev-server --config webpack.dev.config.js --watch --inline --compress --progress --colors --env development",
"release": "NODE_ENV='production' webpack --config webpack.release.config.js --display-error-details --progress --colors",
"release:preact": "NODE_ENV='production' REACT_ENV='preact' webpack --config webpack.release.config.js --display-error-details --progress --colors"
npm run dev error 报错了
你好,最近小项目有尝试您的脚手架。在使用时发现一个小问题,Header组件中,您返回路由使用了this.context.router.goBack(),在react-router-dom的v4版本中,该方法似乎已经放置到了history方法下,即为this.context.router.history.goBack(),不知是否是这样?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.