I wanted to switch to the webpack 5 asset module as recommended. Unfortunately I miss the function "postTransformPublicPath: (path: any) => any" of webpack url-loader.
Due to the structure in our application, the public and private areas of the assets are divided there. With the url loader I could then use the following:
{
test: /\.(png|jp(e*)g|gif|svg)$/,
use: [{
loader: 'url-loader',
options: {
limit: 10 * 1024, // Convert images < 10kb to base64 strings
name: 'private/img/[name].[ext]',
postTransformPublicPath: (path) => path.replace('private/', ''),
},
}],
},
As a result, the urls in the css were set to the path without private, but placed in the private folder in the folder structure. This private folder was then made available as static after Auth.
Is there a possibility to somehow use this behavior with the asset module?
{
test: /\.(png|jp(e*)g|gif|svg)$/,
type: 'asset',
generator: {
filename: 'private/img/[base][query]',
},
},