TrySound / rollup-plugin-terser

Rollup plugin to minify generated bundle
MIT License
609 stars 55 forks source link

Rollup 3.0.0 #119

Open lucien-perouze opened 2 years ago

lucien-perouze commented 2 years ago

This plugin isn't compatible with Rollup 3.0.0.

Do you intend on updating it ?

Thanks.

rexkenley commented 2 years ago

Same here, but with Rollup 3.1.0

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: rollup-plugin-terser@7.0.2 npm ERR! Found: rollup@3.1.0 npm ERR! node_modules/rollup npm ERR! dev rollup@"^3.1.0" from the root project npm ERR! peerOptional rollup@"^1.20.0||^2.0.0||^3.0.0" from @rollup/plugin-image@3.0.0 npm ERR! node_modules/@rollup/plugin-image npm ERR! dev @rollup/plugin-image@"^3.0.0" from the root project npm ERR! 4 more (@rollup/plugin-node-resolve, rollup-plugin-cleaner, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer rollup@"^2.0.0" from rollup-plugin-terser@7.0.2 npm ERR! node_modules/rollup-plugin-terser npm ERR! dev rollup-plugin-terser@"^7.0.2" from the root project npm ERR! npm ERR! Conflicting peer dependency: rollup@2.79.1 npm ERR! node_modules/rollup npm ERR! peer rollup@"^2.0.0" from rollup-plugin-terser@7.0.2 npm ERR! node_modules/rollup-plugin-terser npm ERR! dev rollup-plugin-terser@"^7.0.2" from the root project

UmamiAppearance commented 1 year ago

Use:

npm i rollup-plugin-minification -D

as a replacement.

rollup config:

//import { terser } from "rollup-plugin-terser";
import { terser } from "rollup-plugin-minification";

While waiting for the upgrade I was stuck with a development which depends on this plugin. I decided to hack together a workaround until this is up to date.

  1. Install vanilla terser and rollup-plugin-your-function :

    npm i terser -D
    npm i rollup-plugin-your-function -D
  2. Adjust the rollup config:

    
    //import { terser } from "rollup-plugin-terser";
    import { minify } from "terser";
    import { yourFunction } from "rollup-plugin-your-function";

const terser = () => yourFunction({ output: true, name: "terser", fn: async (source, options) => minify( source, { module: (/^esm?$/).test(options.outputOptions.format), toplevel: options.outputOptions.format === "cjs", sourceMap: true } ) });



Maybe this is useful for anyone else besides me.
</del>
Victor2333 commented 1 year ago

While waiting for the upgrade I was stuck with a development which depends on this plugin. I decided to hack together a workaround until this is up to date.

  1. Install vanilla terser and rollup-plugin-your-function :
npm i terser -D
npm i rollup-plugin-your-function -D
  1. Adjust the rollup config:
//import { terser } from "rollup-plugin-terser";
import { minify } from "terser";
import { yourFunction } from "rollup-plugin-your-function";

const terser = () => yourFunction({
    output: true,
    name: "terser",
    fn: async (source, options) => minify(
        source,
        {
            module: (/^esm?$/).test(options.outputOptions.format),
            toplevel: options.outputOptions.format === "cjs",
            sourceMap: true
        }
    )
});

Maybe this is useful for anyone else besides me.

Thanks!

UmamiAppearance commented 1 year ago

I don't think, that there will be much progress here at the moment. So, I decided to step in for a replacement. If have created rollup-plugin-minification, which you can use as a 1:1 replacement. Right now it is just the packed code I mentioned above .

lucien-perouze commented 1 year ago

I don't think, that there will be much progress here at the moment. So, I decided to step in for a replacement. If have created rollup-plugin-minification, which you can use as a 1:1 replacement. Right now it is just the packed code I mentioned above .

Wow ! The real captain ! 💯 Thank you for your time.

UmamiAppearance commented 1 year ago

Wow ! The real captain

Ahoy! ⚓😁

See you on the other bank.

willeastcott commented 1 year ago

Just so everybody is aware, @tada5hi is contributing a Terser plugin to the official repo of Rollup plugins: https://github.com/rollup/plugins/pull/1323

UmamiAppearance commented 1 year ago

That is good to know.

limonte commented 1 year ago

The official plugin with Rollup v3 support has been released: https://npmjs.com/package/@rollup/plugin-terser 🎉

UmamiAppearance commented 1 year ago

That is good news. My replacement repository is now archived. I'll leave the npm package for a while for an easier transition. Cheers everyone.

limonte commented 1 year ago

That is good news. My replacement repository is now archived. I'll leave the npm package for a while for an easier transition. Cheers everyone.

I'd also recommend npm deprecate rollup-plugin-minification "use @rollup/plugin-terser instead"

UmamiAppearance commented 1 year ago

True and done.

aliehyaie commented 10 months ago

rollup-plugin-minification has been obsoleted use @rollup/plugin-terser npm i -D @rollup/plugin-terser