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

feat: Exclude components from build #5998

Open
3 tasks done
MrGrigri opened this issue Sep 25, 2024 · 1 comment
Open
3 tasks done

feat: Exclude components from build #5998

MrGrigri opened this issue Sep 25, 2024 · 1 comment
Labels
Feature: Want this? Upvote it! This PR or Issue may be a great consideration for a future idea.

Comments

@MrGrigri
Copy link

MrGrigri commented Sep 25, 2024

Prerequisites

Describe the Feature Request

It would be highly beneficial if components could be excluded from the normal build process. Components can already be excluded from the Angular Build, but it would also be beneficial if they could be excluded from all builds.

Describe the Use Case

Currently I contribute to a proprietary design system and we not only build out to the design system, but the repo itself houses demos. But we do not want these demo components built. E.g. button-demo shouldn't be included in the build but button should.

Describe Preferred Solution

The unofficial JSDoc tag @internal is already being used to exclude the component from being used to generate documentation. This could also still be used.

/**
 * @internal
 */
@Component({
  tag: 'button-demo',
})
export class ButtonDemo {}

Describe Alternatives

Follow the same steps as the Angular Output Target where the output target can receive an array of strings in an excludeComponents property. Where each string is the tag of the component.

export const config: Config = {
  ...,
  outputTargets: [
    {
      type: 'dist',
      excludeComponents: ['button-demo']
    }
  ]
}

Related Code

No response

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Sep 25, 2024
@tanner-reits
Copy link
Member

@MrGrigri Hey! Thanks for the request. We've heard feedback like this before, so I'll get this labeled as an official feature request.

Alternatively, you can workaround this limitation by setting up separate build commands (i.e. build.dev and build.prod). Each of these commands could have their own respective Stencil config, but the prod variation would point to a tsconfig file that could specify an exclude pattern for these components you don't want included in the build. Maybe something like this:

// tsconfig.prod.json
{
  "extends": "tsconfig.json",
  "exclude": ["src/components/**/demo/*"]
}

Granted, this approach would exclude the components from all output targets rather than allowing to specify on a per output target basis.

@tanner-reits tanner-reits added Feature: Want this? Upvote it! This PR or Issue may be a great consideration for a future idea. and removed triage labels Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Want this? Upvote it! This PR or Issue may be a great consideration for a future idea.
Projects
None yet
Development

No branches or pull requests

2 participants