umijs / umi

A framework in react community ✨
https://umijs.org
MIT License
15.39k stars 2.65k forks source link

[Bug] 项目中用CSS Modules 识别不了*.less文件 #6151

Closed chenleyiduo closed 3 years ago

chenleyiduo commented 3 years ago

What happens?

项目中用CSS Modules 识别不了*.less文件 image

- config.ts

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', }, });



## Mini Showcase Repository(REQUIRED)

> Please provide a repository using `yarn create @umijs/umi-app` then upload to your GitHub
> 请提供一个可复现的仓库,使用 `yarn create @umijs/umi-app` 创建,并上传到你的 GitHub 仓库

<!-- 为节约大家的时间,无复现步骤的 ISSUE 会被关闭,提供之后再 REOPEN -->
<!-- https://github.com/YOUR_REPOSITORY_URL -->

## How To Reproduce

**Steps to reproduce the behavior:** 1. 2.

**Expected behavior** 1. 2.

<!-- 请提供复现链接/步骤,错误日志以及相关配置 -->

## Context

- **Umi Version**:
- **Node Version**:
- **Platform**:
ycjcl868 commented 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
}