Clean output without deprecation warning.
After webpack update (from v4 to v5) I'm getting deprecation warnings in my console.
(node:7361) [DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET] DeprecationWarning: Compilation.modules was changed from Array to Set (using Array method 'reduce' is deprecated)
(node:41349) [DEP_WEBPACK_MODULE_ERRORS] DeprecationWarning: Module.errors was removed (use getErrors instead)
Using tracing:
node --trace-deprecation node_modules/webpack/bin/webpack.js
Output:
(node:41650) [DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET] DeprecationWarning: Compilation.modules was changed from Array to Set (using Array method 'reduce' is deprecated)
at Set.set.<computed> [as reduce] (/Users/.../myproject/node_modules/webpack/lib/util/deprecation.js:78:4)
at determineModules (/Users/.../myproject/node_modules/ts-loader/dist/after-compile.js:58:32)
(node:41650) [DEP_WEBPACK_MODULE_ERRORS] DeprecationWarning: Module.errors was removed (use getErrors instead)
at /Users/.../myproject/node_modules/ts-loader/dist/after-compile.js:140:45
at Array.forEach (<anonymous>)
Node.js v12.16.2
[email protected]
[email protected]
I'm seeing the same as @artola, and one more (latest webpack, 5.0.0-beta.17):
$ node --trace-deprecation node_modules/webpack/bin/webpack.js
(node:9769) [DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET] DeprecationWarning: Compilation.modules was changed from Array to Set (using Array method 'reduce' is deprecated)
at Set.set.<computed> [as reduce] (.../node_modules/webpack/lib/util/deprecation.js:78:4)
at determineModules (.../node_modules/ts-loader/dist/after-compile.js:58:32)
...
(node:9769) [DEP_WEBPACK_MODULE_ERRORS] DeprecationWarning: Module.errors was removed (use getErrors instead)
at .../node_modules/ts-loader/dist/after-compile.js:140:45
...
(node:9769) [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 outputFileToAsset (.../node_modules/ts-loader/dist/after-compile.js:203:35)
...
Thanks - if someone would like to work on this I'll happily review the PR 馃
For warning regarding Array changed to Set, it might be so simple as replace by return Array.from(compilation.modules).reduce, see here:
I'd like to help, however when I'm inspecting the codebase of ts-loader, I've noticed the usage of errors property:
Can anyone tell me why this needs to remove the errors? In fact, this removal should cause no effects on webpack 5, since every time we retrieve the errors property we will get a copied array, and we can't modify the original errors.
If memory serves (and it may not) this removes errors registered by ts-loader from a previous run, so the full set of current ts-loader errors can be registered without creating duplicates. Make sense?
I've created a PR #1135 , but I don't know why CI would fail.
@sheetalkamat has a PR which drops support for older versions of TypeScript here: https://github.com/TypeStrong/ts-loader/pull/1136
When that's merged we can take a look at your PR - it only seems to be failing on older versions of TypeScript.
i'm still getting this for the versions:
"ts-node": "^8.10.2",
"typescript": "^4.0.2",
"webpack": "^5.0.0-beta.32",
the command is
clear; node --trace-deprecation ../../node_modules/webpack/bin/webpack.js --mode=development --config webpack.dev.js since this is lerna monorepo and actual webpack is in the root
After reading comments here and other links, i couldn't figure out what is actual solution. is there anything i can do? are my package versions incompatible
Still getting the error.
$ node --trace-deprecation $NODE_PATH/webpack/bin/webpack.js
(node:12788) [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 outputFileToAsset (/usr/local/lib/node_modules/ts-loader/dist/after-compile.js:216:35)
at outputFilesToAsset (/usr/local/lib/node_modules/ts-loader/dist/after-compile.js:224:13)
at addDeclarationFilesAsAsset (/usr/local/lib/node_modules/ts-loader/dist/after-compile.js:210:5)
at provideDeclarationFilesToWebpack (/usr/local/lib/node_modules/ts-loader/dist/after-compile.js:206:9)
at /usr/local/lib/node_modules/ts-loader/dist/after-compile.js:30:9
at Hook.eval [as callAsync] (eval at create (/usr/local/lib/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/usr/local/lib/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
at /usr/local/lib/node_modules/webpack/lib/Compiler.js:986:33
at /usr/local/lib/node_modules/webpack/lib/Compilation.js:2025:10
at Hook.eval [as callAsync] (eval at create (/usr/local/lib/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
$ webpack --version
webpack-cli 4.0.0
webpack 5.1.0
$ cat $NODE_PATH/ts-loader/package.json | grep '"version"'
"version": "8.0.5"
Some deprecations have been fixed - some still need to be. All help appreciated! Locking this issue - please continue conversation here instead: https://github.com/TypeStrong/ts-loader/issues/1196
Most helpful comment
i'm still getting this for the versions:
the command is
clear; node --trace-deprecation ../../node_modules/webpack/bin/webpack.js --mode=development --config webpack.dev.jssince this is lerna monorepo and actual webpack is in the rootAfter reading comments here and other links, i couldn't figure out what is actual solution. is there anything i can do? are my package versions incompatible