Skip to content

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

Closed
ionic-team/ionic-framework
#29666

Description

@awk

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.

Activity

  1. added
    Resolution: Needs Investigation
    on Jan 31, 2022
  2. rwaskiewicz commented on Jan 31, 2022

    @rwaskiewicz
    Member

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

  3. tanner-reits commented on Jun 26, 2024

    @tanner-reits
    Contributor

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

  4. dantman commented on Aug 15, 2024

    @dantman

    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?

  5. christian-bromann commented on Aug 16, 2024

    @christian-bromann
    Member

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

  6. dantman commented on Aug 17, 2024

    @dantman

    @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.

  7. christian-bromann commented on Aug 19, 2024

    @christian-bromann
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: Needs Investigation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions