我通过运行创建了一个新的 React 应用程序,npx create-react-app@latest --typescript .并使用运行了该项目npm start,一切都按预期工作。我运行npm install semantic-ui-react semantic-ui-css并安装正确。
但是当我按照指示添加时import 'semantic-ui-css/semantic.min.css';,index.tsx我得到一个failed to compile error.
这是我的index.tsx文件:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import 'semantic-ui-css/semantic.min.css';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or …Run Code Online (Sandbox Code Playgroud)