Skip to content

Commit 52177dd

Browse files
authored
Fix docuilib assets by formatting our base64 is generated (#3653)
1 parent 9c1e992 commit 52177dd

File tree

3 files changed

+95
-1509
lines changed

3 files changed

+95
-1509
lines changed

docuilib/plugins/uilib.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ module.exports = ({siteDir}, _options) => {
3939
use: useBabelForRN
4040
};
4141

42+
const imageLoaderConfiguration = {
43+
include: baseProjectSource,
44+
test: /\.(gif|jpe?g|png|svg)$/,
45+
type: 'asset',
46+
generator: {
47+
dataUrl: content => {
48+
content = content.toString();
49+
const match = content.match(/data:image[^"]+/);
50+
const imageData = match ? match[0] : '';
51+
return imageData;
52+
}
53+
}
54+
};
55+
4256
return {
4357
name: 'uilib-plugin',
4458
configureWebpack(_config, _isServer, _utils) {
@@ -53,7 +67,7 @@ module.exports = ({siteDir}, _options) => {
5367
})
5468
],
5569
module: {
56-
rules: [babelLoaderAppConfiguration]
70+
rules: [babelLoaderAppConfiguration, imageLoaderConfiguration]
5771
},
5872
resolve: {
5973
alias: {

0 commit comments

Comments
 (0)