MaterialDesign-JS icon indicating copy to clipboard operation
MaterialDesign-JS copied to clipboard

Add "exports" in package.json ESM build

Open userquin opened this issue 2 years ago • 10 comments

Feel free to use https://github.com/userquin/mdi-js-es here, if so, I'll deprecate my package/repo.

userquin avatar Nov 27 '23 12:11 userquin

@userquin We provide ES6 and commonjs in the package. If you're having issues with a specific framework/build toolchain let us know.

  • https://github.com/Templarian/MaterialDesign-JS/blob/master/package.json#L6C22-L6C22

Templarian avatar Nov 27 '23 16:11 Templarian

Checking types here https://arethetypeswrong.github.io/?p=%40mdi%2Fjs%407.3.67

imagen

Check also https://publint.dev/@mdi/[email protected]

You should add package exports.

userquin avatar Nov 27 '23 19:11 userquin

@userquin Good call we'll add "exports" in the next release. Updated the title of the bug to reflect this.

Templarian avatar Nov 27 '23 20:11 Templarian

Just build the package, generate the tgz and upload it to first url, should be ESM in node 16 ESM.

userquin avatar Nov 27 '23 20:11 userquin

Thay's why I create mdi-js-es package https://github.com/unplugin/unplugin-auto-import/pull/451

userquin avatar Nov 27 '23 22:11 userquin

This is really needed, currently if we bundle using webpack all icons are included meaning if you just use 2 icon you still get a 3MB sized bundle of icons.

susnux avatar Feb 06 '24 13:02 susnux

@userquin Good call we'll add "exports" in the next release. Updated the title of the bug to reflect this.

Any idea of when the new version will be released?

leogargioni avatar Mar 30 '24 07:03 leogargioni

Right now we're thinking of adding...

{
    ".": "./mdi.js",
    "./*": "./glyph/*/*.js",
}

This would allow '@mdi/js/account' -> glphy/account/account.js.

Templarian avatar Mar 30 '24 15:03 Templarian

See the PR I created, you also need to export the Typescript interface or it could not be used with moduleresolution node16 or later

susnux avatar Mar 30 '24 23:03 susnux

Any updates on when this will be merged in? Looking to use this and move away from MUI framework but holding us back cause of ESM support.

blandfried avatar Apr 17 '24 13:04 blandfried