解决方法:
tsconfig.json
“jsx”: “preserve”
改为
“jsx”: “react”
出错文件:
import ReactDOM from 'react-dom';
import React from 'react';
const App = () => {
return (
<div>
<h1>aaa</h1>
</div>
);
};
const root = document.getElementById('app');
ReactDOM.render(<App />, root);
报错:
ERROR in ./app/app.tsx 9:12
Module parse failed: Unexpected token (9:12)
File was processed with these loaders:
* ./node_modules/ts-loader/index.js
You may need an additional loader to handle the result of these loaders.
| var react_1 = __importDefault(require("react"));
| var App = function () {
> return (<div>
| <h1>aaa</h1>
| </div>);