-
Notifications
You must be signed in to change notification settings - Fork 27
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
Can't minify the output of plugin #45
Comments
@bAbolfazl did you research why it returns undefined? somebody solved something similar here: #33 (comment) |
I have the same problem. I get this error message:
When I try to do this:
If I do a console.log of require("terser").minify(code) I get:
But if I console.log require("terser").minify(code).code it says undefined. |
@andreasnylin This is because Terser.minify returns a Promise. You can do it like this: transform: {
'filename.js': async (code) => (await Terser.minify(code)).code
}, |
@thejahweh Ah yes that's it, thanks! I tried that but places the "async" at the wrong place. |
I have tried to minify the output of this plugin as it said in transform section of documentation:
files: { 'vendor.js': [...] }, transform: { 'vendor.js': code => require("uglify-js").minify(code).code }
But I have faced this error:
throw new ERR_INVALID_ARG_TYPE( TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
Could you give me a way to do the modification on the output of this plugin with other plugins such as Terser?
The text was updated successfully, but these errors were encountered: