Skip to content

fix: add es module#79

Open
sastan wants to merge 1 commit intomathiasbynens:masterfrom
sastan:add-es-module
Open

fix: add es module#79
sastan wants to merge 1 commit intomathiasbynens:masterfrom
sastan:add-es-module

Conversation

@sastan
Copy link

@sastan sastan commented Jan 9, 2021

This PR adds an es module (he.esm.js). This is currently handcrafted by basically removing the UMD wrapper and adding the exports at the bottom of the file. This file is then references from package.json using the module field. This is in my opinion a non-breaking change.

I hope this can be published soon as it would allow he to be used by packages that are esm based and and bundlers that have difficulties to detect the exported names.

I'd like to have this automated but i could not get the grunt build to run:

Running "shell:process-data" (shell) task
/Users/sastan/Projects/os/he/node_modules/sort-object/index.js:71
                var k = get(sortBy, key)[j++];
                                        ^

TypeError: Cannot read property '0' of undefined
    at sort (..../he/node_modules/sort-object/index.js:71:27)
    at Object.<anonymous> (..../he/scripts/process-data.js:96:35)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
Warning: Command failed: node scripts/process-data.js
..../he/node_modules/sort-object/index.js:71
                var k = get(sortBy, key)[j++];
                                        ^

Any hint about how to solve this and i would adjust the PR.

Related #76

@marcos-castrillo
Copy link

Any news regarding this change? My team is looking forward to seeing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants