stencil icon indicating copy to clipboard operation
stencil copied to clipboard

fix(compiler): support rollup's external input option for collection dependencies

Open George-Payne opened this issue 2 years ago • 1 comments

This PR builds upon #3227 to exclude external collection dependencies.

Pull request checklist

Please check if your PR fulfills the following requirements:

  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • [x] Build (npm run build) was run locally and any changes were pushed
  • [x] Unit tests (npm test) were run locally and passed
  • [ ] E2E Tests (npm run test.karma.prod) were run locally and passed
  • [x] Prettier (npm run prettier) was run locally and passed

Pull request type

Please check the type of change your PR introduces:

  • [x] Bugfix
  • [x] Feature
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation content changes
  • [ ] Other (please describe):

What is the current behavior?

GitHub Issue Number: #3576

What is the new behavior?

Passing a external to rollupConfig.inputOptions will be applied to external component collections.

When a collection is parsed, the compiler checks if it matches an external id. If it is matched, the collection info is retained in the cache, but the components are not built, and child collections are not resolved. The side effect import is still removed.

Does this introduce a breaking change?

  • [ ] Yes
  • [x] No

Currently, external is not supported, so this behaviour cannot be accidentally triggered.

Testing

  • Create a local test project.
  • Link to stencil built with changes
  • Add a library dependency
  • Add the library name to rollupConfig.inputOptions.external
  • Build the project, and ensure the components are excluded from the build

Other information

George-Payne avatar Nov 22 '22 12:11 George-Payne