In webpack config for loader
[
{
test: /\.ext1*$/,
loader: 'firstLoader',
},
{
test: /\.ext2*$/,
loader: 'secondLoader'
}
]
If the test for firstLoader matches the file extension, the firstLoader will be loaded, but will the second test be also tested?
I am asking this because for a given file, if somehow a second test also matches (mistake in regex), I wonder if the secondLoader will also be loaded?
Yes, a loader definition is tested and executed when matched. It is common to have a number of loaders each targeting different file extensions, for example to include CSS or image files in the bundle.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.