~cytrogen/masto-fe

ref: 713d217384fdb14dda44c3277f5a9ae4e389e4e2 masto-fe/config/webpack/rules/file.js -rw-r--r-- 520 bytes
713d2173 — dependabot[bot] Bump eslint from 8.39.0 to 8.40.0 (#24919) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const { join } = require('path');
const { settings } = require('../configuration');

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 'media/[path][name]-[hash].[ext]';
          }
          return 'media/[folder]/[name]-[hash:8].[ext]';
        },
        context: join(settings.source_path),
      },
    },
  ],
};