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

Revert "refactor: replace swc with acorn" and remove code deleting #10

Closed huozhi closed 1 year ago

huozhi commented 1 year ago

x-ref: https://github.com/huozhi/rollup-plugin-swc-preserve-directives/pull/4#issuecomment-1706551223

The reason that keeps breaking is we're using a pretty unsafe operation to delete code based on swc node's span as it's already not recommended, which is only for getting rid of the roll warnings. We keep the original approach that we don't delete the code or comments anymore, but skipping the warnings from rollup side.