file.js 565 B

12345678910111213141516171819202122
  1. const { join } = require('path');
  2. const { settings } = require('../configuration');
  3. module.exports = {
  4. test: new RegExp(`(${settings.static_assets_extensions.join('|')})$`, 'i'),
  5. exclude: [/material-icons/, /svg-icons/],
  6. use: [
  7. {
  8. loader: 'file-loader',
  9. options: {
  10. name(file) {
  11. if (file.includes(settings.source_path)) {
  12. return 'media/[path][name]-[hash].[ext]';
  13. }
  14. return 'media/[folder]/[name]-[hash:8].[ext]';
  15. },
  16. context: join(settings.source_path),
  17. },
  18. },
  19. ],
  20. };