huozhi / rollup-preserve-directives

This is a rollup plugin that helps preserve shebang and string directives.
https://npmjs.com/package/rollup-preserve-directives
34 stars 4 forks source link

perf(#19): avoid return half-baked output and less magic string operations #20

Closed SukkaW closed 8 months ago

SukkaW commented 8 months ago

The PR potentially closes huozhi/bunchee#340.

Previously, rollup-preserve-directives would return { code: [original input], map: null } when nothing changed, which might cause huozhi/bunchee#340.

The PR fixes that by returning null if no code changes happen during the phase.

@huozhi Would you like to test if the PR works?

huozhi commented 8 months ago

Looks like it's an issue inside bunchee, since there's another prepend directive plugin. This PR could still be a good improvement 👍