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

Support excluding files from dist #211

Open
cjpearson opened this issue Dec 22, 2023 · 1 comment
Open

Support excluding files from dist #211

cjpearson opened this issue Dec 22, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@cjpearson
Copy link

Hi, is it possible to exclude files matching a certain pattern from the final build? In my case, we have .test.ts files in the same directory as composables and both the composables and test files are transpiled 1:1 to the output dir.

@danielroe danielroe added the enhancement New feature or request label Apr 25, 2024
@cjpearson
Copy link
Author

The current workaround is to use a build:done hook to clean the output directory

  hooks: {
    'build:done'(context) {
      const outDir = context.options.outDir

      // Remove test files from final build output
      context.buildEntries
        .filter((entry) => /\.test(\.d\.ts|\.js|\.mjs)/.test(entry.path))
        .forEach((entry) => {
          return rm(join(outDir, entry.path))
        })
    },
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants