GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — SSR: Add a way to configure `externalDependencies` for the server bundle only with `@angular-devkit/build-angular:application` builder · Issue #26487 · angular/angular-cli

SSR: Add a way to configure externalDependencies for the server bundle only with @angular-devkit/build-angular:application builder  #26487

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
SSR: Add a way to configure externalDependencies for the server bundle only with @angular-devkit/build-angular:application builder #26487
Copy link
Labels
needs: more infoReporter must clarify the issueReporter must clarify the issue

Description

@frankswarm
frankswarm
opened on Nov 24, 2023
Issue body actions

Command

build

Description

I would like to exclude some dependencies from being bundled but just for the server bundle. I can't find the proper way to do that using the @angular-devkit/build-angular:application builder.

Adding externalDependencies to the options prevent the packages from being bundled in both the browser and the server bundles.

Describe the solution you'd like

Maybe update the ssr option with an externalDependencies property that prevents the bundling just for the server.

Describe alternatives you've considered

Stop using the ssr option from @angular-devkit/build-angular:application and using a combination of the same with the @angular-devkit/build-angular:serverbuilder... but, I'm still trying to figure that out too 😅 .

Activity

  1. alan-agius4 commented on Nov 24, 2023

    @alan-agius4
    alan-agius4
    on Nov 24, 2023
    Collaborator
    More actions

    What is the use-case case of having a dependency being external for the server but not for the browser bundle?

  2. alan-agius4
    added
    needs: more infoReporter must clarify the issueReporter must clarify the issue
    on Nov 24, 2023
  3. frankswarm commented on Nov 24, 2023

    @frankswarm
    frankswarm
    on Nov 24, 2023
    Author
    More actions

    Hi, thanks for the quick response! I'm trying to integrate opentelemetry in the server to get traces and metrics. The tooling for NodeJS assumes that the packages (express, pino, etc) are being loaded from node_modules (which is not a crazy assumption 😅) instead of coming from a bundle, to be able to provide automatic instrumentations.

    I saw this issue that was also giving other reasons, but i think the resolution given there no longer applies.

  4. clydin commented on Nov 27, 2023

    @clydin
    clydin
    on Nov 27, 2023
    Member
    More actions

    You should be able to mark the relevant packages external such as express. This shouldn't cause any issues with the browser build since those packages shouldn't be used in a browser anyway.

  5. frankswarm commented on Nov 28, 2023

    @frankswarm
    frankswarm
    on Nov 28, 2023
    Author
    More actions

    Hi @clydin thanks for your input. I'm using your suggestion as a workaround, but I do think there are scenarios in which it is necessary to be able to mark externals for each bundle:

    Scenario 1: Universal/Isomorphic packages

    For example, let's think of an isomorphic/universal package like pino, it would be handy to exclude it from the server bundle and load it from node_modules and, at the same time, have it bundled for the browser.

    Scenario 2: Browser only packages

    Packages that are exclusively meant for the browser and are just bloating the server bundle like @opentelemetry/autoinstrumentations-web

  6. alan-agius4 commented on Dec 5, 2023

    @alan-agius4
    alan-agius4
    on Dec 5, 2023
    Collaborator
    More actions

    Hey @frankswarm, appreciate the insights and scenarios. While I acknowledge their potential usefulness in certain situations, I feel these cases are somewhat uncommon.

    Take Pino, for instance. Its reliance on the module being installed in node_modules seems more like a bug or limitation on their part. Bundling dependencies with node applications is a common practice nowadays.

    Let's revisit this in the future, if it's something the community expresses interest in.

  7. alan-agius4
    closed this as completedon Dec 5, 2023
  8. alan-agius4
    closed this as not plannedon Dec 5, 2023
  9. angular-automatic-lock-bot commented on Jan 5, 2024

    @angular-automatic-lock-bot
    angular-automatic-lock-botBot
    on Jan 5, 2024
    More actions

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  10. angular-automatic-lock-bot
    locked and limited conversation to collaborators on Jan 5, 2024
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

    needs: more infoReporter must clarify the issueReporter must clarify the issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.