Skip to content

Using devextreme and devextreme-react as an external library #2871

@zolem

Description

@zolem

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

I am using a very large library in my spfx solution and I would like to not only share it among webparts within this app but share it across any other webparts that might be using this library.

What I know

  • I know that you can include external libraries such as jquery and some libraries that have typings separate from their npm package.
  • I know that even if I put a reference to an external library in the externals section it won't actually pull down the library if I don't import it anywhere in my code.
  • I understand the current examples in the documentation. I managed to successfully use moment-timezone which is great.

Problem I am having

I am trying to use the DevExtreme and devextreme-react libraries. This library is very large so I want to include it once from a cdn when a webpart is requesting it and continue using the same script with each additional webpart instance. The problem is that the library comes with typings included in it. It is in a subfolder bundles/dx.all.d.ts instead of in its own package. It also has multiple files you can include instead of including the entire library. In addition the devextreme-react is depending on the devextreme library so it is also including files from devextreme.

The project either doesn't load the external libraries because I don't include them, or things fail to compile because I am not importing it properly..? maybe?

My question is how do I exclude the library, add it to externals configuration, import it into my project files with typings and still have my project compile?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:communityarea:otherCategory: unknown (does not fit any other category)help wantedLooking for someone to help with this issue (documentation fix, etc).type:questionQuestion... if answered, will be tagged as such.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions