canvas-kit icon indicating copy to clipboard operation
canvas-kit copied to clipboard

Support JavaScript modules for shared dynamic imports

Open NicholasBoll opened this issue 11 months ago • 1 comments

🚀 Feature Proposal

Bundle our library in a way that is friendly to using JavaScript modules. Moving from Webpack to Vite would help accomplish bundling as well as getting our dev script faster.

Motivation

In order to support shared dynamic imports using JavaScript modules, we need to change the way we build our library. At the moment, we only transform files from TypeScript to JavaScript, but we do not do any bundling. A simple way may be to use Rollup to bundle everything in a slash import:

// Now
react/
  button/
    index.js
    lib/
      parts/
        ButtonBase.js
        PrimaryButton.js

// Proposed
react/
  button.js
  common.js
  

Example

Please provide an example for how this feature would be used.

NicholasBoll avatar Jan 23 '25 17:01 NicholasBoll

In order to have 1 instance of CK instead of many. Pages load faster, fewer chances of bugs due to multiple versions being loaded at the same time.

aek5ba avatar Aug 25 '25 17:08 aek5ba