deprecation-loader

0.0.2 • Public • Published

npm node tests chat

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

module.exports = {
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/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.log('Some code')

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.js
Module Warning (from ./file.js):

------- position --------

line 1; column: 0;

-------- comment --------

*
 * @deprecated [2.0.0]

Options

notify

Enum: warning|error Default: 'warning'

Deprecated Code Notification Type

String

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/i,
        use: [
          {
            loader: 'deprecated-loader',
            options: {
              notify: 'error'
            }
          }
        ]
      }
    ]
  }
}

License

MIT

Package Sidebar

Install

npm i deprecation-loader

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

7.31 kB

Total Files

11

Last publish

Collaborators

  • novavovikov