I am learning this imports-loader on webpack. I've already built several webpack demo projects by following tutorials.
Here is the code to configure imports-loader:
// ./webpack.config.js
module.exports = {
...
module: {
loaders: [
{
test: require.resolve("some-module"),
loader: "imports?this=>window"
}
]
};
My questions:
- Normally, the "test" should be a regex expression. What is the
require.resolve("some-module")
here? what does it mean?