Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin don't support "include" and "exclude" #54

Open
suanmei opened this issue Dec 14, 2018 · 10 comments
Open

Plugin don't support "include" and "exclude" #54

suanmei opened this issue Dec 14, 2018 · 10 comments

Comments

@suanmei
Copy link

suanmei commented Dec 14, 2018

I want to generate two versions of the file

  • A compressed version of the file
  • An uncompressed version of the file

So I need it to let me choose to compress or not compress for a file by include or exclude

Just like uglifyjs-webpack-plugin

@TrySound
Copy link
Owner

This plugin is able to transform only bundles, not specific files. So these options just doesn't make sense. As a solution you may use condition

[
  ...
  condition && uglify()
  ...
]

@suanmei
Copy link
Author

suanmei commented Dec 14, 2018

yeah,I just want to specify the bundle like that

uglify({
  include: '/\.min\.js$/'
})

@suanmei
Copy link
Author

suanmei commented Dec 14, 2018

This is too simple for you to add two apis

transformBundle(code, options) {
  yourFunc(options.file)
  ...
  ...
}

@TrySound
Copy link
Owner

This won't work if chunk names are autogenerated

@TrySound
Copy link
Owner

I think I would accept this feature. Could you prepare a PR?

@suanmei
Copy link
Author

suanmei commented Dec 14, 2018

Completely fine

@suanmei
Copy link
Author

suanmei commented Dec 22, 2018

UglifyJs can‘t accept options other than the one it specifies, so ---

do you want me to change your options format like that

{
  include: /\/includes/,
  exclude: /\/exclude/,
  uglifyOptions: {} // uglifyJS API options
}

and change the version to 7.0.0, so it won't affect the previous users

or

let me do some compatibility with versions prior to 6.0.0 and 6.0.0, such as removing include and exclude before passing options to uglifyJS, which is not conducive to extending new features in the future.

@suanmei
Copy link
Author

suanmei commented Dec 22, 2018

I looked at the latest documentation. If you don't specify a filename, it won't automatically generate a new filename, but instead output it directly to the command line tool.

@suanmei
Copy link
Author

suanmei commented Dec 24, 2018

@TrySound look forward to your reply

@TrySound
Copy link
Owner

TrySound commented Jan 1, 2019

I set sourceMap to undefined, look at the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants