privatenumber / pkgroll

📦 Zero-config package bundler for Node.js + TypeScript
MIT License
1.01k stars 23 forks source link

Support rollup plugins or use @rollup/plugin-strip to remove debugger statements. #43

Closed kiki-kanri closed 10 months ago

kiki-kanri commented 10 months ago

Feature request

Customize the use of the rollup plugins or use parameters (such as --strip) when executing the command to enable the @rollup/plugin-strip package.

Motivations

Debugger statements used in development are not used in production, so I want to use the plugins to remove these debugger statements.

Whether to support the use of additional configuration files to customize the rollup plugins?

Alternatives

No response

Additional context

No response

Contributions

privatenumber commented 10 months ago

I'm not sure how common it is for devs to want to produce distribution code while still having debugger in the source and auto stripping it. Is there a precedent of bundlers supporting this?

Regarding customization, this tool basically configures Rollup for you so I'd like for it to export a function so users can configure Rollup too. Something like:

rollup.config.js

import { extendConfig } from 'pkgroll'

export default extendConfig({
    plugins: [
        // ...
    ]
})
kiki-kanri commented 10 months ago

When I think about it, it's not very common to include a debugger in the class or function to be export, so this feature may not be needed.

However, it may be possible to set plugins or other parameters using a custom rollup config in future, which is optional and works fine without rollup.config.js in file list.

Incidentally, when will you merge this PR and release a new version?

privatenumber commented 10 months ago

Oh yeah, I dropped the ball on that one. It requires a breaking change release but I'll try to pick it up soon.

pjeby commented 6 months ago

So, I couldn't figure out from this if rollup plugins are supported? (I'd like to be able to change the build process for a project that includes SCSS files imported as strings.) It looks like the proposed extendConfig doesn't exist yet?