Bug 2020428

Summary: Dynamic Plugins: Deprecation warning building plugin
Product: OpenShift Container Platform Reporter: Samuel Padgett <spadgett>
Component: Management ConsoleAssignee: Vojtech Szocs <vszocs>
Status: CLOSED DEFERRED QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.10CC: aos-bugs, yapei
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Version: 4.10.0-0.nightly-2021-11-02-121455 Cluster ID: 9ea8814c-6752-42b0-a543-95040233c65e Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.104 Safari/537.36
Last Closed: 2023-03-09 01:08:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Samuel Padgett 2021-11-04 20:11:32 UTC
The following warning is printed when building a plugin:

> DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.

This appears to be coming from ConsoleRemotePlugin when running with `--trace-deprecation` enabled. I'm building the following plugin:

https://github.com/spadgett/console-customization-plugin

But I suspect it happens with any plugin.

```
yarn run v1.22.15
$ yarn clean && NODE_ENV=production NODE_OPTIONS=--trace-deprecation yarn ts-node node_modules/.bin/webpack
$ rm -rf dist
$ ts-node -O '{"module":"commonjs"}' node_modules/.bin/webpack
(node:5651) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.
BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation.
        Do changes to assets earlier, e. g. in Compilation.hooks.processAssets.
        Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.
    at Compilation.updateAsset (/Users/sam/work/console-customization-plugin/node_modules/webpack/lib/Compilation.js:4241:22)
    at /Users/sam/work/console-customization-plugin/node_modules/src/webpack/ConsoleRemotePlugin.ts:81:19
    at Hook.eval [as callAsync] (eval at create (/Users/sam/work/console-customization-plugin/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/sam/work/console-customization-plugin/node_modules/tapable/lib/Hook.js:18:14)
    at Compiler.emitAssets (/Users/sam/work/console-customization-plugin/node_modules/webpack/lib/Compiler.js:871:19)
    at /Users/sam/work/console-customization-plugin/node_modules/webpack/lib/Compiler.js:459:10
    at processTicksAndRejections (internal/process/task_queues.js:77:11)
```

Comment 4 Yadan Pei 2021-11-15 10:09:23 UTC
1. clone latest console repo
# git clone git:openshift/console.git; cd console
2. clone console-customization-plugin repo
# git clone git:spadgett/console-customization-plugin.git
# cd console-customization-plugin; yarn install
3. Run `yarn run build` in console-customization-plugin dir

~/go/src/github.com/openshift/console/console-customization-plugin/ [main] yarn run build
yarn run v1.22.10
$ yarn clean && NODE_ENV=production yarn ts-node node_modules/.bin/webpack
$ rm -rf dist
$ ts-node -O '{"module":"commonjs"}' node_modules/.bin/webpack
(node:4310) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.
BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation.
	Do changes to assets earlier, e. g. in Compilation.hooks.processAssets.
	Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.
(Use `node --trace-deprecation ...` to show where the warning was created)
assets by info 3.08 MiB [immutable]
  assets by path *.js 3.08 MiB
    assets by chunk 3 MiB (id hint: vendors) 4 assets
  assets by chunk 388 bytes (auxiliary id hint: vendors) 6 assets
assets by path assets/*.jpg 1.53 MiB
  assets by status 1.17 MiB [big]
    asset assets/pfbg_992 575 KiB [emitted] [from: ../node_modules/@patternfly/react-styles/css/assets/images/pfbg_992] [big] (auxiliary id hint: vendors)
    asset assets/pfbg_768 354 KiB [emitted] [from: ../node_modules/@patternfly/react-styles/css/assets/images/pfbg_768] [big] (auxiliary id hint: vendors)
    asset assets/pfbg_2000.jpg 270 KiB [emitted] [from: ../node_modules/@patternfly/react-styles/css/assets/images/pfbg_2000.jpg] [big] (auxiliary id hint: vendors)
  asset assets/pfbg_576 191 KiB [emitted] [from: ../node_modules/@patternfly/react-styles/css/assets/images/pfbg_576] (auxiliary id hint: vendors)
  asset assets/pfbg_768.jpg 114 KiB [emitted] [from: ../node_modules/@patternfly/react-styles/css/assets/images/pfbg_768.jpg] (auxiliary id hint: vendors)
  asset assets/pfbg_576.jpg 65.9 KiB [emitted] [from: ../node_modules/@patternfly/react-styles/css/assets/images/pfbg_576.jpg] (auxiliary id hint: vendors)
asset plugin-entry.js 8.7 KiB [emitted] [minimized] (name: console-customization) 1 related asset
asset plugin-manifest.json 1.57 KiB [emitted]
orphan modules 997 KiB [orphan] 604 modules
runtime modules 21.4 KiB 13 modules
built modules 3.83 MiB (javascript) 388 bytes (asset) 546 bytes (consume-shared) 336 bytes (share-init) [built] 327 modules

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  assets/pfbg_2000.jpg (270 KiB)
  assets/pfbg_768 (354 KiB)
  assets/pfbg_992 (575 KiB)
  168-chunk-3391de88a16eeb636916.min.js (2.96 MiB)

webpack 5.61.0 compiled with 1 warning in 17163 ms
✨  Done in 31.16s.

From above output, we can still see following warning

```
(node:4310) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.
BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation.
	Do changes to assets earlier, e. g. in Compilation.hooks.processAssets.
	Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.
(Use `node --trace-deprecation ...` to show where the warning was created)
```

moving back for confirmation

Comment 7 Shiftzilla 2023-03-09 01:08:42 UTC
OpenShift has moved to Jira for its defect tracking! This bug can now be found in the OCPBUGS project in Jira.

https://issues.redhat.com/browse/OCPBUGS-9018