Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove empty dirs (recursively) #125

Open
Andrew15-5 opened this issue Aug 15, 2023 · 0 comments
Open

Remove empty dirs (recursively) #125

Andrew15-5 opened this issue Aug 15, 2023 · 0 comments

Comments

@Andrew15-5
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant