filemanager-webpack-plugin
filemanager-webpack-plugin copied to clipboard
Remove empty dirs (recursively)
Config
const path = require('path');
const FilemanagerWebpackPlugin = require('filemanager-webpack-plugin');
const output_dir = path.resolve('public');
const js_dir = path.join(output_dir, 'js');
const config = {
output: {
path: output_dir,
},
plugins: [
new FilemanagerWebpackPlugin({
events: {
onEnd: {
delete: [path.join(js_dir, '**', '*.d.ts')],
},
},
}),
],
};
Issue
I have ts-loader
that is used instead of tsc
, therefore I can't remove .d.ts
. I was able to achieve it with this plugin, but now I have empty dirs. I was wondering if I can do something like:
delete: [
{
source: 'dir/**',
options: {
'only-empty-dirs': true,
},
},
],
I want it to be able to recursively (because of **
) remove all empty dirs (starting from the bottom or with smart check).
I don't know how to change the config syntax, but I would also like to remove the top source
dir itself too, if everything inside it is only empty dirs.
Your Environment
Tech | Version |
---|---|
filemanager-plugin-webpack | 8.0.0 |
node | v18.16.0 |
OS | Pop!_OS 22.04 |