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

bug: rollup's 'external' option is not supported in stencil.config #3226

Closed
3 tasks done
awk opened this issue Jan 29, 2022 · 6 comments · Fixed by ionic-team/ionic-framework#29666
Closed
3 tasks done
Labels
Resolution: Needs Investigation This PR or Issue should be investigated from the Stencil team

Comments

@awk
Copy link
Contributor

awk commented Jan 29, 2022

Prerequisites

Stencil Version

2.13.0

Current Behavior

Rollup provides an option to supply a value for external (a string, regex, array of either or a function) - https://rollupjs.org/guide/en/#external However stencil does not support this option in the rollupConfig.inputOptions section of a stencil.config

Expected Behavior

With an external option specified the matching packages would be excluded from the output bundle (per rollups default behavior)

Steps to Reproduce

Add

rollupConfig: {
    inputOptions: {
      external: /foo*/,
    }
  },

to a stencil.config.ts in a new project and observe that the option is flagged as an error by typescript and that it has no impact on the generated bundle files.

Code Reproduction URL

Additional Information

There is commentary about supporting this rollup option in #1938 - but that issue is now stale and only contributors can comment.

@ionitron-bot ionitron-bot bot added the triage label Jan 29, 2022
@rwaskiewicz rwaskiewicz added Bug: Needs Validation Resolution: Needs Investigation This PR or Issue should be investigated from the Stencil team labels Jan 31, 2022
@ionitron-bot ionitron-bot bot removed the triage label Jan 31, 2022
@rwaskiewicz
Copy link
Contributor

Thanks for this issue report! I see the accompanying both for the team to take a look at both a little more closely.

@tanner-reits
Copy link
Contributor

A fix for this was included in today's v4.19.0 release!

github-merge-queue bot pushed a commit to ionic-team/ionic-framework that referenced this issue Jun 26, 2024
### Release Notes

<details>
<summary>ionic-team/stencil (@&#8203;stencil/core)</summary>

###
[`v4.19.0`](https://github.com/ionic-team/stencil/blob/HEAD/CHANGELOG.md#-4190-2024-06-26)

[Compare
Source](https://github.com/ionic-team/stencil/compare/v4.18.3...v4.19.0)

### Bug Fixes

* **compiler:** support rollup's external input option
([#3227](stenciljs/core#3227))
([2c68849](stenciljs/core@2c68849)),
fixes [#3226](stenciljs/core#3226)
* **emit:** don't emit test files
([#5789](stenciljs/core#5789))
([50892f1](stenciljs/core@50892f1)),
fixes [#5788](stenciljs/core#5788)
* **hyrdate:** support vdom annotation in nested dsd structures
([#5856](stenciljs/core#5856))
([61bb5e3](stenciljs/core@61bb5e3))
* label attribute not toggling input
([#3474](stenciljs/core#3474))
([13db920](stenciljs/core@13db920)),
fixes [#3473](stenciljs/core#3473)
* **mock-doc:** expose ShadowRoot and DocumentFragment globals
([#5827](stenciljs/core#5827))
([98bbd7c](stenciljs/core@98bbd7c)),
fixes [#3260](stenciljs/core#3260)
* **runtime:** allow watchers to fire w/ no Stencil members
([#5855](stenciljs/core#5855))
([850ad4f](stenciljs/core@850ad4f)),
fixes [#5854](stenciljs/core#5854)
* **runtime:** catch errors in async lifecycle methods
([#5826](stenciljs/core#5826))
([87e5b33](stenciljs/core@87e5b33)),
fixes [#5824](stenciljs/core#5824)
* **runtime:** don't register listener before connected to DOM
([#5844](stenciljs/core#5844))
([9d7021f](stenciljs/core@9d7021f)),
fixes [#4067](stenciljs/core#4067)
* **runtime:** properly assign style declarations
([#5838](stenciljs/core#5838))
([5c10ebf](stenciljs/core@5c10ebf))
* **testing:** allow to re-use pages across it blocks
([#5830](stenciljs/core#5830))
([561eab4](stenciljs/core@561eab4)),
fixes [#3720](stenciljs/core#3720)
* **typescript:** remove unsupported label property
([#5840](stenciljs/core#5840))
([d26ea2b](stenciljs/core@d26ea2b)),
fixes [#3473](stenciljs/core#3473)


### Features

* **cli:** support generation of sass and less files
([#5857](stenciljs/core#5857))
([1883812](stenciljs/core@1883812)),
closes [#2155](stenciljs/core#2155)
* **compiler:** generate export maps on build
([#5809](stenciljs/core#5809))
([b6d2404](stenciljs/core@b6d2404))
* **complier:** support type import aliasing
([#5836](stenciljs/core#5836))
([7ffb25d](stenciljs/core@7ffb25d)),
closes [#2335](stenciljs/core#2335)
* **runtime:** support declarative shadow DOM
([#5792](stenciljs/core#5792))
([c837063](stenciljs/core@c837063)),
closes [#4010](stenciljs/core#4010)
* **testing:** add `toHaveLastReceivedEventDetail` event spy matcher
([#5829](stenciljs/core#5829))
([63491de](stenciljs/core@63491de)),
closes [#2488](stenciljs/core#2488)
* **testing:** allow to disable network error logging via
'logFailingNetworkRequests' option
([#5839](stenciljs/core#5839))
([dac3e33](stenciljs/core@dac3e33)),
closes [#2572](stenciljs/core#2572)
* **testing:** expose captureBeyondViewport in pageCompareScreenshot
([#5828](stenciljs/core#5828))
([cf6a450](stenciljs/core@cf6a450)),
closes [#3188](stenciljs/core#3188)

</details>
@dantman
Copy link

dantman commented Aug 15, 2024

I tried using rollupConfig.inputOptions.external to mark some dependences that must not be included in the library bundle as external. It works in the library. However when running with --serve the Integrated Dev Server has a TypeError: Failed to resolve module specifier "{the module}". Relative references must start with either "/", "./", or "../". undefined error for anything marked as external.

It seems we may need some way to ensure things marked as external are bundled for the Integrated Dev Server?

@christian-bromann
Copy link
Member

@dantman thanks for reporting, is there a chance you can provide a reproducible example?

@dantman
Copy link

dantman commented Aug 17, 2024

@dantman thanks for reporting, is there a chance you can provide a reproducible example?

I'm not sure, I may have finished that project and I didn't usually work with Stencil. I can say that the project was using multiple output targets. www output for a demo component, web components, es5, and react if I recall correctly. It used various dependencies and the web component build would end up bundling them into the library. And there was a stateful module that would end up duplicated breaking things. Externalizing dependencies would fix the issue in the web component build but break the demo component in --serve.

@christian-bromann
Copy link
Member

Thanks. If anyone comes across the same issue, please feel free to raise an issue with a reproduction case. At this point I cam't do further investigations on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Needs Investigation This PR or Issue should be investigated from the Stencil team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants