FredKSchott / rollup-plugin-polyfill-node

A modern Node.js polyfill for your Rollup bundle.
Other
177 stars 57 forks source link

fix: expose `modules` file #51

Closed MichaelDeBoey closed 2 years ago

MichaelDeBoey commented 2 years ago

Closes #50

FredKSchott commented 2 years ago

I'm not sure what you mean by "expose modules file", this just appears to move files around in the final output package. Can you explain more about what this change is meant to do?

MichaelDeBoey commented 2 years ago

Before this PR, the only entry point was index.js/index.mjs. By setting preserveModules to true, we can also do import { getModules } from 'rollup-plugin-polyfill-node/modules', which is what's needed for https://github.com/remorses/esbuild-plugins/pull/19

// before
|- dist
    |- types
    |   |- index.d.ts
    |   |- modules.d.ts
    |   |- polyfills.d.ts
    |- index.js
    |- index.mjs
// after
|- dist
    |- es
    |   |- index.js
    |   |- modules.js
    |   |- polyfills.js
    |- index.d.ts
    |- index.js
    |- modules.d.ts
    |- modules.js
    |- polyfills.d.ts
    |- polyfills.js
FredKSchott commented 2 years ago

Got it, that makes sense. Thanks for the PR!