Answer the question
In order to leave comments, you need to log in
How does searching for files by string work in Webpack?
I have a task to remove unused files from the project.
Given: `app` folder, it contains files:
*.js, *.jsx, *.ts, *.tsx
and tests: *.test.js, *.test.jsx.
I'm using the `unused-files-webpack-plugin` plugin, where I have to specify the PATH of the files to be checked:
{ patterns: ['app/**/*.js', 'app/**/*.ts', 'app/**/*.jsx', 'app/**/*.tsx'] }
Answer the question
In order to leave comments, you need to log in
This pattern is handled by the node-glob library ( https://github.com/isaacs/node-glob#glob-primer ), which in turn creates a search regular expression based on the Glob Primer.
I don't understand why it is needed. Apparently, for programmers who do not learn regular expressions =)
Or make it easier to write paths (IMHO declarative)
example:
/^app\/.+[jt]sx?$/g; // регулярка
'app/**/*.[jt]s{,x}'; // node-glob шаблон
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question