README
polyfill-exports
Create a script to polyfill requiring ES package "exports" for nodejs 12 below.
Install
$ npm install -D polyfill-exports
# or
$ yarn add --dev polyfill-exports
Usage
Build the polyfill script:
$ npx polyfill-exports
# or
$ yarn run polyfill-exports
then add the script into package.json "files" and "postinstall" hook.
// your package.json
{
...,
"exports": {
"foo": "./lib/foo.js"
},
"script": {
"postinstall": "node ./polyfill-exports.js"
},
"files": [
...,
"polyfill-exports.js"
]
...
}
Delete polyfill files
$ npx polyfill-exports --delete
# or
$ yarn run polyfill-exports --delete