Closed fanksy closed 3 months ago
Please leave the complete code so that it can be reproduced.
I fail to see there's anything wrong. Please check this commit out.
import React from 'react';
import { connect } from 'react-redux';
const ConditionModal = loadable(() => import('components/ConditionModal'));
@connect((state) => {
return {
};
})
export default class MyComponent extends React.Component {
componentDidMount() {}
render() {
const {
visible,
} = this.props;
return (
<>
{!!visible && (true)}
{true && <ConditionModal />}
</>
);
}
}
Swc4jTranspileOptions options = new Swc4jTranspileOptions() .setCaptureAst(true) .setMediaType(Swc4jMediaType.Jsx);
Swc4jParseOutput parseOutput = swc4j.parse(script, options); Swc4jAstModule module = (Swc4jAstModule) parseOutput.getProgram();
com.caoccao.javet.swc4j.exceptions.Swc4jCoreException: Using the export keyword between a decorator and a class is not allowed. Please use export @dec class
instead. at file:///main.js:14:1
@connect((state) => {
~
...
})
~~
at com.caoccao.javet.swc4j.exceptions.Swc4jCoreException.parseError(Swc4jCoreException.java:54)
at com.caoccao.javet.swc4j.Swc4jNative.coreParse(Native Method)
at com.caoccao.javet.swc4j.Swc4j.parse(Swc4j.java:80)
I hope this can help you to figure it out.
Please set the media type to Tsx
and try again.
Please set the media type to
Tsx
and try again.
测试OK
Tsx完全兼容Jsx ?
Jsx都可以用Tsx来解析?
I think it's your decision to parse the templates as Jsx or Tsx.
请问该如何设置才能正常解析
有一个相关的issue:https://github.com/babel/babel-eslint/issues/662
解决方式:
这个在Options里面没有对应的选项