Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support import as ES module type #209

Closed
Tracked by #396
bolinocroustibat opened this issue Mar 22, 2021 · 6 comments
Closed
Tracked by #396

Support import as ES module type #209

bolinocroustibat opened this issue Mar 22, 2021 · 6 comments
Milestone

Comments

@bolinocroustibat
Copy link

It would be great if Tweakpane could support ES module (type="module") import.

@asiryk
Copy link

asiryk commented Apr 27, 2022

Is there any progress on this issue? 👀

It is very nice and quick to use an esmodule. No need to set up a bundler and you get all the type hints from the lsp

@cocopon
Copy link
Owner

cocopon commented May 1, 2022

It's tough work in several reasons:

For now you can use Skypack, the CDN that converts packages into ES modules.

Ref: #207 (comment)

@braebo
Copy link

braebo commented Aug 1, 2022

This fixes skypack's typescript support:
Doesn't seem to help, but it's a clue:

You can add typing to a module via declare module. Create .d.ts file with this:

declare module "https://cdn.skypack.dev/chai" {
  import chai from "chai";
  export = chai;
}

From: microsoft/TypeScript#46936 (comment)

@ghostdevv
Copy link

ESM Supports importing from esm or cjs so that isn't an issue. Especially when using typescript as there are extra compatibility features. The type issue I found is the lack of @tweakpane/core as a dependancy of tweakpane

You can easily support multiple distributions for this package, if you expect people to be bundling this then ESM support is also super important as that is the only way to treeshake. You should take a look at tsup to replace the current rollup build step you have

@cocopon cocopon added this to the 4.0.0 milestone Aug 4, 2022
@cocopon cocopon mentioned this issue Aug 25, 2022
24 tasks
@cocopon cocopon mentioned this issue Oct 18, 2022
cocopon added a commit that referenced this issue Apr 25, 2023
@cocopon
Copy link
Owner

cocopon commented Jun 22, 2023

Published the beta release of the next major version v4 and it's ES module.

You can try it with npm install tweakpane@beta, or downloading it manually: https://github.com/cocopon/tweakpane/releases/tag/4.0.0-beta.1

@cocopon
Copy link
Owner

cocopon commented Aug 6, 2023

Released in v4.0.0.

@cocopon cocopon closed this as completed Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants