@@ -187,16 +187,18 @@ export const lessLoader = (args: ConfigArgs) => ({
187187} ) ;
188188
189189// eslint-disable-next-line @typescript-eslint/no-unused-vars
190- export const assetsLoader = ( _args : ConfigArgs ) => ( {
191- test : / \. ( j p e ? g | p n g | s v g | g i f | w o f f | w o f f 2 | t t f | e o t | o t f ) ( \? .+ ?) ? $ / ,
192- // asset (or asset auto) will either compile as data-uri or to a file path
193- // based on the size, this is a good strategy for loading assets in the GUI
194- type : 'asset' ,
195- parser : {
196- dataUrlCondition : {
197- maxSize : 2 * 1024 , // 2kb
198- } ,
199- } ,
190+ export const fontLoader = ( _args : ConfigArgs ) => ( {
191+ test : / \. ( w o f f | w o f f 2 | t t f | e o t | o t f ) ( \? .+ ?) ? $ / ,
192+ // fonts are always big and should be emitted as a separate file
193+ type : 'asset/resource' ,
194+ } ) ;
195+
196+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
197+ export const imageLoader = ( _args : ConfigArgs ) => ( {
198+ test : / \. ( j p e ? g | p n g | s v g | g i f ) ( \? .+ ?) ? $ / ,
199+ // it's convenient to inline images as data-urls to make sure that publised
200+ // library artifacts only produce importable javascript assets
201+ type : 'asset/inline' ,
200202} ) ;
201203
202204// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -223,7 +225,7 @@ export const sourceLoader = (args: ConfigArgs) => ({
223225 nodeLoader ( args ) . test ,
224226 cssLoader ( args ) . test ,
225227 lessLoader ( args ) . test ,
226- assetsLoader ( args ) . test ,
228+ resourceLoader ( args ) . test ,
227229 sharedObjectLoader ( args ) . test ,
228230 // Produced by html-webpack-plugin and should not be handled
229231 / \. ( e j s | h t m l ) $ / ,
0 commit comments