search-loader
v0.2.3
Published
Search and match file contents for regex patterns.
Downloads
1
Readme
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.