Skip to content

A fork of tweakpane-image-plugin with build optimizations.

License

Notifications You must be signed in to change notification settings

kitschpatrol/tweakpane-plugin-image

 
 

Repository files navigation

@kitschpatrol/tweakpane-plugin-image

NPM Package @kitschpatrol/tweakpane-plugin-image

Overview

This is a fork of Florian Morel, Matheus Dias, and Palash Bansal's tweakpane-image-plugin with externalized dependencies.

This allows for smaller bundled file sizes in projects using multiple Tweakpane plugins.

It is published to NPM primarily for the Svelte Tweakpane UI project, and will be kept in sync with the upstream version of the plugin, with minimal changes other than dependency externalization.

For most use cases, you probably don't want this fork!

Background

The Rollup configuration provided in the Tweakpane plugin template does not externalize @tweakpane/core as a production dependency.

Instead, it gets built into the single-file plugin artifact, which is what's published to NPM and imported by plugin consumers. This makes it easy to import as an ES module from a URL, but means that larger projects importing multiple Tweakpane plugins end up with duplicate copies of the @tweakpane/core code, adding about ~100 Kb to the final minified build for each plugin after the first.

Externalizing this dependency allows build tools like vite to share a single instance of the @tweakpane/core code across multiple plugins.

If you're not using a bundler, direct ESM imports from URLs can still work if needed by defining the @tweakpane/core dependency in an importmap.

Implementation notes

The ancestry of this fork is a bit complicated. It's based on Florian Morel's original work, but merges changes from Matheus Dias's fork and Palash Bansal's fork. See the GitHub network graph for some clarity.

I believe Matheus's fork is what's currently published as tweakpane-image-plugin on NPM.

Note the package name change from tweakpane-image-plugin to @kitschpatrol/tweakpane-plugin-image in the sanity-preserving spirit of hierarchical naming.

PNPM is used as the package manager.

About

A fork of tweakpane-image-plugin with build optimizations.

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • TypeScript 58.1%
  • JavaScript 20.0%
  • HTML 16.4%
  • SCSS 5.5%