search-loader

0.2.3 • Public • Published

search-loader

Search across webpack resources

Installation

npm i --save-dev search-loader

Usage

Add the search loader configuration to the beginning of any loader chain to search among that file type

const webpackConfiguration = {
  // ...
  module: {
    rules: [
      {
        test: /\.js$/,
        use: [
          {loader: 'babel-loader'},
          {
            loader: 'search-loader',
            options: {
              regex: new RegExp(/test/, 'g'),
              output: path.resolve(__dirname, 'search/output.json'),
              verbose: false,
            },
          },
        ],
      },
      // ...
    ],
  },
  //...
}

Options

  • regex: A regular expression to apply to the source. Don't forget the 'g' flag if you want to find all matches within a source file.
  • output: An absolute file path to store the search results.
  • verbose: Prints out search results and other debugging messages.

Package Sidebar

Install

npm i search-loader

Weekly Downloads

1

Version

0.2.3

License

ISC

Unpacked Size

4.03 kB

Total Files

8

Last publish

Collaborators

  • auzmartist