alibaba / alibaba/ice

icejs2使用webpack, svg文件不支持source形式导入,全部变成了base64

Open
#5,115 3 comments 1 reaction 1 assignee Claimed by @ClarkXia View on GitHub
PR Welcome
Dominant language
TypeScript
Stars
18.6k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

## What is the current behavior? 发生了什么?

icejs2 使用 webpack5,对静态资源默认使用了base64导入,对于svg文件使用source导入需要在module rules配置type,目前没有看到 webpackLoaders支持配置type的地方。

![image](https://user-images.githubusercontent.com/34162213/148714626-d3604b7d-c69d-440c-8db1-48dd6348e784.png)
![image](https://user-images.githubusercontent.com/34162213/148714634-dc313144-184a-410d-9d11-d24ec5f84e42.png)

自定义svg icon组件,需要把svg source 通过 dangerouslySetInnerHTML 插入到 dom 里。
webpack5内置了asset/source能力,反而不需要使用 svgo-loader 和 raw-loader了

工作自定义插件修改是可行的:
![image](https://user-images.githubusercontent.com/34162213/148714692-e8bbdaa1-73b5-4fc8-9b3a-0de8c3105197.png)

## What is the expected behavior? 期望的结果是什么?

webpackLoaders支持配置type,或有提供plugins设置type类型

## Any additional comments? 相关环境信息?

- **ice.js Version**:2
- **build.json Configuration**:
- **Node Version**:
- **Platform**:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.