Closed chenleyiduo closed 3 years ago
create typings.d.ts
file in the current workspace.
declare module '*.css';
declare module '*.less';
declare module '*.png';
declare module '*.svg' {
export function ReactComponent(props: React.SVGProps<SVGSVGElement>): React.ReactElement
const url: string
export default url
}
What happens?
项目中用CSS Modules 识别不了*.less文件
项目目录结构:
package.json
tsconfig.eslint.json
tsconfig.json
.eslintrc.js
import { defineConfig } from 'umi'; import { Routes } from './routes';
const { REACT_APP_ENV } = process.env; let prox = {}; // 设置代理跟多环境 if (REACT_APP_ENV === 'lt') { prox = { '/audit': { target: 'http://localhost:9090', changeOrigin: true, secure: false, }, }; } export default defineConfig({ qiankun: { slave: {}, }, nodeModulesTransform: { type: 'none', }, // 开启dva dva: {}, // 路由配置 routes: Routes, proxy: prox, // antd: { // compact: true, // }, polyfill: { imports: ['core-js/stable'], }, history: { type: 'hash', }, });