Skip to content

xxx.module.scss 还是不能编译,引入无效 #1828

@flycj

Description

@flycj

Describe the bug

采用umi 最新版本创建的项目,最小复现仓库:https://github.com/flycj/umi-mako4.4.8

pnpm dlx create-umi@latest 创建
umi: 4.4.8
mako 版本: 0.11.9
node: v20.18.1

问题1:make 还是不支持 xxx.module.scss 的写法,具体看项目中 pages/index.tsx 页面,采用 import styles from './index.module.scss'; 后样式无效

问题2:umi采用mako 配置后,在调整 index.module.scss 的时候,命令行工具会报错,导致项目运行中断,报错信息如下:

node_modules\.pnpm\@umijs+preset-umi@4.4.8_@types+node@22.14.1_@types+react@18.3.20_lightningcss@1.22.1_rollup@3_ag626x2jyzdgcuzxevuvn57obq\node_modules\@umijs\preset-umi\dist\features\appData\appData.js:131
        content: JSON.stringify(api.appData, null, 2),
                      ^

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Array'
    |     index 2 -> object with constructor 'LessPlugin'
    |     property 'params' -> object with constructor 'Object'
    |     property 'config' -> object with constructor 'Object'
    --- property 'plugins' closes the circle
    at JSON.stringify (<anonymous>)
    at Hook.fn (D:\Users\xxx\tests\umi4.4.8\node_modules\.pnpm\@umijs+preset-umi@4.4.8_@types+node@22.14.1_@types+react@18.3.20_lightningcss@1.22.1_rollup@3_ag626x2jyzdgcuzxevuvn57obq\node_modules\@umijs\preset-umi\dist\features\appData\appData.js:131:23)
    at async D:\Users\xxx\tests\umi4.4.8\node_modules\.pnpm\@umijs+core@4.4.8\node_modules\@umijs\core\dist\service\service.js:184:15

Reproduction

https://github.com/flycj/umi-mako4.4.8

Logs

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions