microsoft / microsoft/AdaptiveCards

[Feature Request] Can we make 'Swiper' dependency optional?

Open
#8,928 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Request
Dominant language
C#
Stars
2k
Forks
595
Avg merge
1d 19h
Merged PRs (30d)
1

Description

Problem Statement

We are using this 'adaptivecards' package in our web app to render Adaptive Card payload, but we don't support mobile browser (we have native mobile apps for that). We find that the 'swiper' package, which 'adaptivecards' depends on, adds 139KB to our total bundle.

From my understanding, the 'swiper' package is not cross platform. It is meant only for mobile apps and mobile websites. As such, our web app is essentially bundling dead code.

Proposed solution

Is it possible to make 'swiper' an optional dependency so that we can exclude this library from our bundle? I see that it is being used by the Carousel.ts file via the require() statement. Can we change it to a dynamic import so that it doesn't fail if 'swiper' is not available?

Alternatives or Workarounds

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Carousel.ts and the package dependency configuration; trace the current require() and how the web bundle includes swiper. Done means swiper can be absent without a load failure and consumers that need the Carousel still work, with the bundle impact verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.