⊗tlWpAsIT 51 of 55 menu

Inline Assets in Webpack

Let's try inline assets now. In this case, the images will be converted to base64. Let's try:

export default { entry: './src/index.js', output: { filename: 'bundle.js', path: path.resolve('dist'), }, module: { rules: [ { test: /\.png$/, type: 'asset/inline' } ] }, plugins: [ new HtmlWebpackPlugin(), ], };

Make .svg images become inline assets. Test your settings on an example image.

enru