代码拉取完成,页面将自动刷新
按照文档https://taroify.gitee.io/taroify.com/quickstart 的做法实现组件的按需导入, 发现实时编译导致CPU飙升,编辑器直接卡死, 干掉babel.config.js的plugins配置恢复正常。配置如选:
module.exports = {
presets: [
[
'taro',
{
framework: 'react',
ts: true
}
]
],
plugins: [
[
'import',
{
libraryName: '@taroify/core',
libraryDirectory: '',
style: true
},
'@taroify/core'
],
[
'import',
{
libraryName: '@taroify/icons',
libraryDirectory: '',
camel2DashComponentName: false,
style: () => '@taroify/icons/style'
},
'@taroify/icons'
]
]
}
依赖如下:
"dependencies": {
"@babel/runtime": "^7.17.2",
"@taroify/core": "^0.0.29-alpha.9",
"@tarojs/components": "3.4.11",
"@tarojs/plugin-framework-react": "^3.4.11",
"@tarojs/runtime": "3.4.11",
"@tarojs/taro": "3.4.11",
"classnames": "^2.3.1",
"crypto-js": "^4.1.1",
"dayjs": "^1.10.7",
"react": "^17.0.2",
"umtrack-wx": "^2.7.1"
},
"devDependencies": {
"@babel/core": "^7.17.2",
"@tarojs/cli": "3.4.11",
"@tarojs/mini-runner": "3.4.11",
"@tarojs/webpack-runner": "3.4.11",
"@types/classnames": "^2.3.1",
"@types/react": "^17.0.39",
"@types/webpack-env": "^1.16.3",
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"babel-plugin-import": "^1.13.3",
"babel-preset-taro": "3.4.1",
"cross-env": "^7.0.3",
"eslint": "^6.8.0",
"eslint-config-taro": "3.4.1",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-react-hooks": "^4.2.0",
"stylelint": "9.3.0",
"taro-iconfont-cli": "^3.3.0",
"typescript": "^4.5.5",
"webpack-bundle-analyzer": "^4.5.0"
}
0.0.29-alpha.8~9 均有这个问题