deprecated-loader
The deprecated-loader
notifies deprecated code.
Getting Started
To begin, you'll need to install deprecated-loader
:
$ npm install deprecated-loader --save-dev
Then add the loader to your webpack
config. For example:
webpack.config.js
moduleexports = module: rules: test: /\.$/i use: loader: 'deprecated-loader'
Use comment @deprecated [2.0.0]
in your code.
In square brackets, indicate the version after which the code should be removed:
file.js
/** * @deprecated [2.0.0] */console
And run webpack
via your preferred method.
If the version of the app in package.json is greater than or equal to the version of the code,
you will see comments in the terminal:
WARNING in ./file.jsModule Warning : ----------------line: 13text: @deprecated [2.0.0]----------------
Options
notification
Enum: warning|error|none
- default: 'warning'
Deprecated code notification type
webpack.config.js
moduleexports = module: rules: test: /\.$/i use: loader: 'deprecated-loader' options: notification: 'error'