Closed
ionic-team/ionic-framework
#29666Labels
Resolution: Needs InvestigationThis PR or Issue should be investigated from the Stencil team
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
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.
Reacted by Tom Wayson, Jonathan, Ben Abbenanti and Hyyan Abo Fakher
Metadata
Metadata
Assignees
Labels
Resolution: Needs InvestigationThis PR or Issue should be investigated from the Stencil team
Activity
rwaskiewicz commentedon Jan 31, 2022
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 commentedon Jun 26, 2024
A fix for this was included in today's v4.19.0 release!
chore(deps): update dependency @stencil/core to v4.19.0 (#29666)
dantman commentedon Aug 15, 2024
I tried using
rollupConfig.inputOptions.externalto mark some dependences that must not be included in the library bundle as external. It works in the library. However when running with--servethe Integrated Dev Server has aTypeError: Failed to resolve module specifier "{the module}". Relative references must start with either "/", "./", or "../". undefinederror 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 commentedon Aug 16, 2024
@dantman thanks for reporting, is there a chance you can provide a reproducible example?
dantman commentedon Aug 17, 2024
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 commentedon Aug 19, 2024
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.