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

DefaultsError: warnings is not a supported option #3394

Closed
lhtdesignde opened this issue May 2, 2019 · 3 comments
Closed

DefaultsError: warnings is not a supported option #3394

lhtdesignde opened this issue May 2, 2019 · 3 comments

Comments

@lhtdesignde
Copy link

lhtdesignde commented May 2, 2019

Bug report
When using the latest version 3.5.10 I'm seeing error when building with webpack.
Version 3.5.9 has no problems.

Version 3.5.10, webpack version 4.29.6

JavaScript output or error produced.

ERROR in ac6445b1ba753e562a1c.js from UglifyJs
DefaultsError: `warnings` is not a supported option
    at DefaultsError.Object.defineProperty.get (eval at <anonymous> (/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:71:23)
    at Function.buildError (/node_modules/uglifyjs-webpack-plugin/dist/index.js:103:53)
    at results.forEach (/node_modules/uglifyjs-webpack-plugin/dist/index.js:256:52)
    at Array.forEach (native)
    at taskRunner.run (/node_modules/uglifyjs-webpack-plugin/dist/index.js:231:17)
    at step (/node_modules/uglifyjs-webpack-plugin/dist/TaskRunner.js:83:9)
    at done (/node_modules/uglifyjs-webpack-plugin/dist/TaskRunner.js:94:30)
    at boundWorkers (/Users/node_modules/uglifyjs-webpack-plugin/dist/TaskRunner.js:99:13)
    at TaskRunner.boundWorkers.error [as boundWorkers] (/node_modules/uglifyjs-webpack-plugin/dist/TaskRunner.js:68:11)
    at enqueue (/node_modules/uglifyjs-webpack-plugin/dist/TaskRunner.js:89:14)
    at tasks.forEach (/node_modules/uglifyjs-webpack-plugin/dist/TaskRunner.js:109:9)
    at Array.forEach (native)
    at TaskRunner.run (/node_modules/uglifyjs-webpack-plugin/dist/TaskRunner.js:87:11)
    at UglifyJsPlugin.optimizeFn (/node_modules/uglifyjs-webpack-plugin/dist/index.js:225:18)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (/node_modules/tapable/lib/Hook.js:154:20
@alexlamsl
Copy link
Collaborator

I've just checked, and even uglifyjs-webpack-plugin does not use the deprecated compress.warnings option anymore.

And since you haven't provided any details of your particular issue, I can only assume that you've the following:

{
    "compress": {
        "warnings": value
    }
}

instead of simply:

{
    "warnings": value
}

@lhtdesignde
Copy link
Author

I do. That fixes it. Thanks for the quick reply/fix!

@Preston-Landers
Copy link

I noticed the same error (warnings is not a supported option) in my setup using uglify-js 3.5.6 and uglifyjs-webpack-plugin 2.1.2 and webpack 4.30.0. I'm not sure why but the error only popped up in the last few days even though I hadn't touched my package versions in a few weeks.

I wasn't setting compress -> warnings in my config. However, what I am doing is calling UglifyJS.default_options() and tweaking that. The default_options apparently did include the unwanted compress -> warnings setting.

I see warnings: false listed in uglify-js/lib/compress.js at line 97 in uglify-js 3.5.6, so that's where it came from.

I upgraded to uglify-js 3.5.10 and in that version, warnings is no longer listed in compress.js in the defaults stuff and I don't get the error. So I guess that's my fix. I still don't understand why it only popped up recently because I haven't changed anything there in a while, but at least I have a solution. I'm noting this for the benefit of anyone else in a similar situation.

jchip added a commit to electrode-io/electrode that referenced this issue May 6, 2019
sorrycc pushed a commit to umijs/umi that referenced this issue May 27, 2019
due to [this change](mishoo/UglifyJS#3394) in Uglify-js, umi build breaks.
This commit change the Uglify-js config to support the new grammer
peterblazejewicz added a commit to peterblazejewicz/DefinitelyTyped that referenced this issue Mar 9, 2020
- add missing: `assignments`, `directives`, `functions`, `keep_fargs`,
`objects`, `pure_funcs`
- remove `warnings` options
- refine JSDoc comments and add defaults

https://github.com/mishoo/UglifyJS2#compress-options
mishoo/UglifyJS#3394 (comment)

Thanks!
peterblazejewicz added a commit to peterblazejewicz/DefinitelyTyped that referenced this issue Mar 10, 2020
- add missing: `assignments`, `directives`, `functions`, `keep_fargs`,
`objects`, `pure_funcs`
- remove `warnings` options
- refine JSDoc comments and add defaults

https://github.com/mishoo/UglifyJS2#compress-options
mishoo/UglifyJS#3394 (comment)

Thanks!
markhigham added a commit to uktrade/export-wins-ui that referenced this issue Mar 17, 2020
uniqueiniquity pushed a commit to DefinitelyTyped/DefinitelyTyped that referenced this issue Mar 31, 2020
* update(uglify-js): update Compression options

- add missing: `assignments`, `directives`, `functions`, `keep_fargs`,
`objects`, `pure_funcs`
- remove `warnings` options
- refine JSDoc comments and add defaults

https://github.com/mishoo/UglifyJS2#compress-options
mishoo/UglifyJS#3394 (comment)

Thanks!

* [fix] update UglifyJS webpack plugin usage

Fixes issue with CI build in WebPack tests
https://git.io/JvKu7
https://github.com/mishoo/UglifyJS2#compress-options
markhigham added a commit to uktrade/export-wins-ui that referenced this issue Apr 8, 2020
joelstevick added a commit to joelstevick/quill-emoji that referenced this issue Dec 4, 2020
nlawrence22 added a commit to BuildingConnected/react-datepicker that referenced this issue Jan 6, 2022
Was receiving errors like the following:

[!] (uglify plugin) Error: Error transforming bundle with 'uglify' plugin: `warnings` is not a supported option
Error: Error transforming bundle with 'uglify' plugin: `warnings` is not a supported option
    at error (/Users/lawrenn/code/bc/react-datepicker/node_modules/rollup/dist/rollup.js:185:14)
    at /Users/lawrenn/code/bc/react-datepicker/node_modules/rollup/dist/rollup.js:9544:5

Looks like the fix for this is to move warnings to the top level
of the options object, rather than nested in compress; see:
mishoo/UglifyJS#3394
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

3 participants