Build: Replace the file-loader loader with asset module in webpack config (#53088)
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user