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

fix: do not emit emit deprecation warning while call deprecation plugin itself #414

Closed
wants to merge 1 commit into from
Closed

fix: do not emit emit deprecation warning while call deprecation plugin itself #414

wants to merge 1 commit into from

Conversation

meskill
Copy link

@meskill meskill commented Apr 13, 2021

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

Deprecation warning

DeprecationWarning: less.webpackLoaderContext is deprecated and will be removed in next major release. Instead use pluginManager.webpackLoaderContext (https://webpack.js.org/loaders/less-loader/#plugins)

will be shown independently by user settings by the less-loader itself

This pr changes the way the deprecation warning plugin checks for already added webpackLoaderContext in lessProcessor

Breaking Changes

Additional Info

@codecov
Copy link

codecov bot commented Apr 13, 2021

Codecov Report

Merging #414 (1a82eb6) into master (a48a770) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #414   +/-   ##
=======================================
  Coverage   96.87%   96.87%           
=======================================
  Files           4        4           
  Lines         128      128           
  Branches       32       32           
=======================================
  Hits          124      124           
  Misses          4        4           
Impacted Files Coverage Δ
src/utils.js 97.59% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a48a770...1a82eb6. Read the comment docs.

@alexander-akait
Copy link
Member

Weird, it should not output unnecessary warning, can you provide example how we can reproduce?

package.json Outdated
"lint:prettier": "prettier --list-different .",
"lint:js": "eslint --cache .",
"lint:prettier": "prettier --list-different src/**/*.js test/**/*.js",
"lint:js": "eslint --cache src/**/*.js test/**/*.js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not change this

@meskill
Copy link
Author

meskill commented Apr 14, 2021

Weird, it should not output unnecessary warning, can you provide example how we can reproduce?

I've tried to debug this part https://github.com/webpack-contrib/less-loader/blob/master/src/index.js#L34 with console logs

I do not know how it should work, but it seems like some files are handled in parallel, so webpackLoaderContext is still in less when new file get handled and not yet removed by this line https://github.com/webpack-contrib/less-loader/blob/master/src/index.js#L47

Logs in my project:

___init___
___render
__end
___init___
___render
__end
___init___
___render
__end
___init___
___render
__end
___init___
___render
__end
___init___
___render
___init___
___render
(node:11826) DeprecationWarning: less.webpackLoaderContext is deprecated and will be removed in next major release. Instead use pluginManager.webpackLoaderContext (https://webpack.js.org/loaders/less-loader/#plugins)
(Use `node --trace-deprecation ...` to show where the warning was created)
__end
__end

And based on #413 it is common issue

@cap-Bernardito cap-Bernardito mentioned this pull request Apr 14, 2021
6 tasks
@meskill meskill deleted the fix/deprecation-warning branch April 15, 2021 14:32
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

Successfully merging this pull request may close these issues.

2 participants