Im trying to integrate pdftron into an existing vite.js build.
As the mentioned in the link above, I copied all necessary assets into my output-folder. But all the files sum up to more than 300MB. So I want to exclude some feature which I don't need. The vendor ships a script for optimizing the library, but it's not possible to run the optimization script automated right now.
Anyhow, I want to mimic the behavior of the optimization script  by removing the biggest unnecessary folders from the build. But somehow I'm unable to exclude the subdirectories from beeing copied. I guess there is a very stupid mistake within my configuration. Below there is an extract from my vite.config.js. I tried multiple different ways of excluding the directory (as you can see it turned into a guessing game). Nothing worked so far.
If necessary, I will provide a demo project.
import copy from "rollup-plugin-copy";
const outputDir = 'build';
/**
 * @type {import('vite').UserConfig}
 */
const config = {
  build: {
    outDir: outputDir,
    emptyOutDir: false,
    assetsDir: '.',
    lib: {
      entry: 'index.js',
      name: 'my-lib',
      fileName: 'my-lib.js',
      formats: ['es']
    },
    rollupOptions: {
      output: {
        entryFileNames: `my-lib.js`,
        chunkFileNames: `[name].js`,
        assetFileNames: `[name].[ext]`
      },
      plugins: [copy({
        targets: [
          {
            src: ['node_modules/@pdftron/webviewer/public/*', '!core/pdf/full/*'],
            dest: outputDir + '/pdftron1'
          },
          {
            src: ['node_modules/@pdftron/webviewer/public', '!node_modules/@pdftron/webviewer/public/core/pdf/full/*'],
            dest: outputDir + '/pdftron2'
          },
          {
            src: ['node_modules/@pdftron/webviewer/public', '!node_modules/@pdftron/webviewer/public/core/pdf/full'],
            dest: outputDir + '/pdftron3'
          },
          {
            src: ['node_modules/@pdftron/webviewer/public', '!node_modules/@pdftron/webviewer/public/core/pdf/full/'],
            dest: outputDir + '/pdftron4'
          },
          {
            src: ['node_modules/@pdftron/webviewer/public', '!node_modules/@pdftron/webviewer/public/core/pdf/full/**'],
            dest: outputDir + '/pdftron5'
          },
        ]
      })
      ]
    },
  },
}
export default config
package.json:
{
  "name": "pdftron-vite-example",
  "version": "1.0.0",
  "scripts": {
    "build": "vite build"
  },
  "dependencies": {
    "@pdftron/webviewer": "8.7.0"
  },
  "devDependencies": {
    "vite": "^2.9.13",
    "rollup-plugin-copy": "^3.3.0"
  }
}