Skip to content

Commit c17250f

Browse files
authored
fix(webpack.config.bundle.esm): always inline SVG assets (#56)
1 parent b737bd6 commit c17250f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/react-scripts/config/webpack.config.bundle.esm.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ module.exports = function (webpackEnv) {
139139
const svgRule = config.module.rules[oneOfRuleIndex].oneOf.find(
140140
rule => String(rule.test) === '/\\.svg$/'
141141
);
142+
142143
if (shouldProduceCompactBundle) {
143144
/**
144145
* We want all SVG files become part of the bundle.
145146
*/
146-
svgRule.type = 'asset/inline';
147-
delete svgRule.use;
147+
delete svgRule.oneOf.splice(0, 1);
148148
} else {
149-
svgRule.use[1].options.name = '[name].[hash].[ext]';
149+
svgRule.oneOf[0].use[1].options.name = '[name].[hash].[ext]';
150150
}
151151

152152
if (shouldProduceCompactBundle) {

0 commit comments

Comments
 (0)