thednp / bootstrap.native

Bootstrap components build with Typescript
http://thednp.github.io/bootstrap.native/
MIT License
1.7k stars 177 forks source link

ESM default export missing #477

Closed verheyenkoen closed 5 days ago

verheyenkoen commented 3 months ago

The How to use wiki demonstrates this example on how to import BSN in an ESM type project.

import BSN from "bootstrap.native";

let myBtnInit = new BSN.Button('#myBtnID');

This doesn't work for me (at least not using esbuild) as there doesn't seem to be a default export. This can be fixed using the * as BSN syntax (but that cannot be combined with named imports).

import * as BSN from "bootstrap.native";

let myBtnInit = new BSN.Button('#myBtnID');

I guess it might be better to provide it as a default export as well, or if not update the examples (unless this is a pure esbuild issue).

thednp commented 3 months ago

I guess something happened to Vite 4.5 -> 5.X the build is different again.

thednp commented 3 months ago

@verheyenkoen so we update the Wiki as suggested?

verheyenkoen commented 3 months ago

@thednp That's your call really. Don't know a lot about how Vite and if this is an intended (breaking) change.