We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1:安装,preact preact-compat preact-redux
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"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
React 迁移 Preact
1:安装,
preact
preact-compat
preact-redux
2:preact-compat的作用是让我们简单转换升级,只需简单修改代码适配即可
3: 设置 preact-compat 的 Alias,在webpack文件中:
4:安装其他对应preact插件
5:一键替换,只需要对应脚本即可
The text was updated successfully, but these errors were encountered: