TrySound / rollup-plugin-uglify

Rollup plugin to minify generated bundle
MIT License
260 stars 42 forks source link

Export uglify function as module default #58

Closed Lanfei closed 5 years ago

Lanfei commented 5 years ago

Support:

`import uglify from "rollup-plugin-uglify";`
TrySound commented 5 years ago

@Lanfei What is wrong with named export? You don't like it? I don't use default exports for the year and I may tell from that experience it's absolutely useless thing.

Lanfei commented 5 years ago

@TrySound No, actually default export and named export are both fine for me, I didn't remove the named export. I'd like to add the default export because users can import the plugin just like other official rollup plugins:

Won't work:

import uglify from "rollup-plugin-uglify";
import commonjs from 'rollup-plugin-commonjs';
import typescript from 'rollup-plugin-typescript';

Won't work as well:

import {uglify} from "rollup-plugin-uglify";
import {commonjs} from 'rollup-plugin-commonjs';
import {typescript} from 'rollup-plugin-typescript';

The only way to make them work is to import them by different ways:

import {uglify} from "rollup-plugin-uglify";
import commonjs from 'rollup-plugin-commonjs';
import typescript from 'rollup-plugin-typescript';
TrySound commented 5 years ago

Imports are independent so it's okay.