You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
主要有两个错误,目前已经找到原因。 错误一:组件XXX路径错误,请检查!(可能原因是导出的组件名不正确)
报这个错是因为我组件直接导出的是匿名函数,如: export default ({ title }) => <View>{title}</View>
改为传统方式就没问题了,如:
`export default class XXX extends Component {
render(){
const { title } = this.props;
return ({title})
}`
错误二:TypeError: unknown: Cannot read property 'name' of null { TypeError: unknown: Cannot read property 'name' of null at ClassDeclaration (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.1.2.26@eslint-plugin-taro/rules/class-naming.js:60:77) at listeners.(anonymous function).forEach.listener (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/util/safe-emitter.js:47:58) at Array.forEach (<anonymous>) at Object.emit (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/util/safe-emitter.js:47:38) at NodeEventGenerator.applySelector (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/util/node-event-generator.js:251:26) at NodeEventGenerator.applySelectors (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/util/node-event-generator.js:280:22) at NodeEventGenerator.enterNode (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/util/node-event-generator.js:294:14) at CodePathAnalyzer.enterNode (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/code-path-analysis/code-path-analyzer.js:608:23) at Traverser.enter [as _enter] (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/linter.js:865:28) at Traverser._traverse (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/util/traverser.js:132:14) _babel: true }
这是因为我导出的匿名对象,如: export default class extends Component {
我改为 export default class XXX extends Component {
就没问题了。
之前用 react 时习惯了,导出没有状态的组件 和 导出匿名对象;为什么taro不支持呢?
The text was updated successfully, but these errors were encountered:
主要有两个错误,目前已经找到原因。
错误一:组件XXX路径错误,请检查!(可能原因是导出的组件名不正确)
报这个错是因为我组件直接导出的是匿名函数,如:
export default ({ title }) => <View>{title}</View>
改为传统方式就没问题了,如:
`export default class XXX extends Component {
render(){
const { title } = this.props;
return ({title})
}`
错误二:TypeError: unknown: Cannot read property 'name' of null
{ TypeError: unknown: Cannot read property 'name' of null at ClassDeclaration (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.1.2.26@eslint-plugin-taro/rules/class-naming.js:60:77) at listeners.(anonymous function).forEach.listener (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/util/safe-emitter.js:47:58) at Array.forEach (<anonymous>) at Object.emit (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/util/safe-emitter.js:47:38) at NodeEventGenerator.applySelector (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/util/node-event-generator.js:251:26) at NodeEventGenerator.applySelectors (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/util/node-event-generator.js:280:22) at NodeEventGenerator.enterNode (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/util/node-event-generator.js:294:14) at CodePathAnalyzer.enterNode (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/code-path-analysis/code-path-analyzer.js:608:23) at Traverser.enter [as _enter] (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/linter.js:865:28) at Traverser._traverse (/usr/local/lib/node_modules/.@tarojs/cli_npminstall/node_modules/.4.19.1@eslint/lib/util/traverser.js:132:14) _babel: true }
这是因为我导出的匿名对象,如:
export default class extends Component {
我改为
export default class XXX extends Component {
就没问题了。
之前用 react 时习惯了,导出没有状态的组件 和 导出匿名对象;为什么taro不支持呢?
The text was updated successfully, but these errors were encountered: