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

分包中公用的scss文件,打包优化 #12013

Closed
heymie opened this issue Jun 30, 2022 · 1 comment
Closed

分包中公用的scss文件,打包优化 #12013

heymie opened this issue Jun 30, 2022 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers walk-around 绕过问题

Comments

@heymie
Copy link

heymie commented Jun 30, 2022

这个特性解决了什么问题?

在开启最小化主包的功能下,当前分包中公用scss全部拷贝至需要使用的页面,导致拷贝多份,是否可以保持原有结构不变,节省分包size。

这个 API 长什么样?

能够优化scss的打包逻辑,示例demo:https://github.com/heymie/test_sub_common_scss

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 4, 2022

与分包无关,Sass 的行为就是会把 @import merge 到同一个输出的样式文件中。

建议 Sass 变量、函数使用 Sass @import,公共样式使用 JS import。这样公共样式才能被 Webpack Splitchunk 正确抽取到公共模块。

@Chen-jj Chen-jj closed this as completed Jul 4, 2022
@Chen-jj Chen-jj added good first issue Good for newcomers walk-around 绕过问题 labels Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers walk-around 绕过问题
Projects
None yet
Development

No branches or pull requests

2 participants