umijs / umi

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

[Bug] third party css is not bundled in production #12081

Closed hasakilol closed 10 months ago

hasakilol commented 10 months ago

What happens?

Mini Showcase Repository(REQUIRED)

Please provide a minimal reproduction then upload to your GitHub. 请提供 最小重现,并上传到你的 GitHub 仓库

How To Reproduce

Steps to reproduce the behavior: 1. 2.

import BraftEditor from 'braft-editor';
import 'braft-editor/dist/index.css';

In development mode, it's ok. But in production mode, the css is missing.

Expected behavior 1. 2. in production mode, the css is not missing.

Context

import BraftEditor from 'braft-editor';
import 'braft-editor/dist/index.css';
github-actions[bot] commented 10 months ago

由于缺乏足够的信息,我们暂时关闭了该 Issue。请修改(不要回复) Issue 提供最小重现以重新开启。谢谢。

hasakilol commented 10 months ago

I checked the build result. braft editor css is already bundled in 6666.sdf99378.chunk.css. However it's referenced from no where. In umi.df8sdf83.js, I find the following code:

a.u=function(e){return({xx: "yy"}[e]||e)+"."+{6666:"14af1bdc"}[e]+".async.js"},a.miniCssF=function(e){return({66:"sdf99378"}[e]+".chunk.css"}

However, ****.14af1bdc.async.js is not emitted at all. Do you have any clue?

hasakilol commented 10 months ago

我找到了另外一个chunk css。 它和6666.sdf99378.chunk.css 有同样的现象(找不到 **.***.async.js),但是它被referenced了,所以加载到浏览器了。

hasakilol commented 10 months ago

Please ignore my question. I have figured it out. umi 4 lazily loaded my code. And I didn't put import 'braft-editor/dist/index.css';in that code.