Closed create3000 closed 7 months ago
I've decided to distribute v4 exclusively as ES modules for better maintainability. If you need UMD support, you can continue to use v3.
I actually assumed that you could automate the whole thing with a build script and that this would not result in any additional work for you.
There are many ways to use the package: through npm, package bundlers, tsc, or directly using a bundled file, etc. For example, package.json have a property "type: module", indicating that this package exclusively supports ES modules, and does your suggestion still work under these conditions? I'll need to verify all compatibilities for each method by writing test cases, ensuring support across future updates.
sir please add UMD version i want to use your library in my library
But my library is for both UMD AND ES
So i would need to manually modify and host the CDN
Plz help!!!
my modification's
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.tweakpane = {})) })(this, (function (exports) { 'use strict'
//rest of your library while replacing "export { BladeApi, ButtonApi, FolderApi, ListBladeApi, ListInputBindingApi, Pane, Semver, SeparatorBladeApi, SliderBladeApi, SliderInputBindingApi, TabApi, TabPageApi, TextBladeApi, TpChangeEvent, VERSION };"
exports.BladeApi = BladeApi
exports.ButtonApi = ButtonApi
exports.FolderApi = FolderApi
exports.ListBladeApi = ListBladeApi
exports.ListInputBindingApi = ListInputBindingApi
exports.Pane = Pane
exports.Semver = Semver
exports.SeparatorBladeApi = SeparatorBladeApi
exports.SliderBladeApi = SliderBladeApi
exports.SliderInputBindingApi = SliderInputBindingApi
exports.TabApi = TabApi
exports.TabPageApi = TabPageApi
exports.TextBladeApi = TextBladeApi
exports.TpChangeEvent = TpChangeEvent
exports.VERSION = VERSION
}))
Here is my opinion at this time. https://github.com/cocopon/tweakpane/issues/599#issuecomment-1923456585
I am using Electron, and libraries can only be imported view
require
. Version 3.* of Tweakpane was still available as UMD, thank you guys. With some small changes,package.json
could handle this:This is a minimal example how it could be. Please be careful with the path names, dots and slashes are important, names and suffixes can be choosen as you like. It should then be possible to use Tweakpane with both ESM
import
statement and Noderequire
.