You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
soapbox/webpack/rules/file.js

21 lines
553 B

5 years ago
const { join } = require('path');
const { settings, packsPath } = require('../configuration');
5 years ago
module.exports = {
test: new RegExp(`(${settings.static_assets_extensions.join('|')})$`, 'i'),
use: [
{
loader: 'file-loader',
options: {
name(file) {
if (file.includes(settings.source_path)) {
return packsPath('media/[path][name]-[hash].[ext]');
5 years ago
}
return packsPath('media/[folder]/[name]-[hash:8].[ext]');
5 years ago
},
context: join(settings.source_path),
},
},
],
};