Build: Replace the file-loader loader with asset module in webpack config (#53088)

This commit is contained in:
Esteban Beltran
2022-08-04 10:29:42 +02:00
committed by GitHub
parent 6b8316d510
commit 112f69177b
5 changed files with 193 additions and 211 deletions
@@ -1,39 +0,0 @@
const fs = require('fs-extra');
const path = require('path');
class CopyUniconsPlugin {
/**
* @param {import('webpack').Compiler} compiler
*/
apply(compiler) {
compiler.hooks.afterEnvironment.tap(
'CopyUniconsPlugin',
/**
* @param {import('webpack').Compilation} compilation
*/
() => {
let destDir = path.resolve(__dirname, '../../../public/img/icons/unicons');
if (!fs.pathExistsSync(destDir)) {
let srcDir = path.join(
path.dirname(require.resolve('iconscout-unicons-tarball/package.json')),
'unicons/svg/line'
);
fs.copySync(srcDir, destDir);
}
let solidDestDir = path.resolve(__dirname, '../../../public/img/icons/solid');
if (!fs.pathExistsSync(solidDestDir)) {
let srcDir = path.join(
path.dirname(require.resolve('iconscout-unicons-tarball/package.json')),
'unicons/svg/solid'
);
fs.copySync(srcDir, solidDestDir);
}
}
);
}
}
module.exports = CopyUniconsPlugin;