Templarian / MaterialDesign-JS

Dist for Material Design Icons JS/TypeScript
Other
161 stars 18 forks source link

ESM Exports? #24

Closed bestickley closed 2 years ago

bestickley commented 2 years ago

Feature Request: ESM Exports.

I use Vite for front-end tooling and without ESM exports the whole library is sent to the browser.

romelperez commented 2 years ago

Another alternative is to split every icon into a separate JS file so even using CommonJS they can be imported separately.

Templarian commented 2 years ago

The package already provides an ESM.

Not familiar with Vite, but all modern JS frameworks have tree shaking, so you might need to configure it.

Please open an issue on the main repo if this is actually an issue.

blackbing commented 1 year ago

@bestickley I forked and build as separated file to support es module. try to use this version to check if it solve your problem. npm i blackbing/MaterialDesign-JS#feature/es

the main change is here https://github.com/Templarian/MaterialDesign-JS/commit/f08bac66f60e0238b60c90ed95a677b5611bdaf5

I just write these strings to separated file.it will allow some old bundler treat es module as well.

If it solved your problem, I will open an issue to main repo