Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧐[问题] 构建出来的产物中css压缩问题 #183

Open
monoplasty opened this issue Dec 11, 2024 · 0 comments
Open

🧐[问题] 构建出来的产物中css压缩问题 #183

monoplasty opened this issue Dec 11, 2024 · 0 comments

Comments

@monoplasty
Copy link

🧐 问题描述

使用 umi 4.3.25 搭建的框架,antd-style 版本:3.7.0

源码中书写方式如下:
Snipaste_2024-12-11_17-58-58

构建完成之后的产物如下:
Snipaste_2024-12-11_17-56-04

问题:
书写的css 中 大量换行和注释 在产物中全部展示出来了,不利于代码安全。也增大了产物的大小。

自己尝试解决的方法:
在 config.ts 中配置 emotion babel 插件,但是构建完之后还是一样的效果。 不知道是不是我配置有问题,还是其他原因导致没有生效?

export default defineConfig({
  routes: [
   ....
    { path: '*', layout: false, component: '404' },
  ],
  helmet: false,
  extraBabelPlugins: [require.resolve('babel-plugin-antd-style'), require.resolve('@emotion/babel-plugin')],
  title: DEFAULT_NAME,
  npmClient: 'pnpm',
});

希望有遇到的大佬能帮忙解决一下!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant