-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Description
The docs say that null-loader
is deprecated and gives an example of how to do it:
W> [`null-loader`](https://github.com/webpack-contrib/null-loader) is deprecated in webpack 5. use `alias: { xyz$: false }` or absolute path `alias: {[path.resolve(__dirname, './path/to/module')]: false }` |
webpack.js.org/src/content/configuration/resolve.mdx
Lines 144 to 154 in 3553600
```js | |
module.exports = { | |
//... | |
resolve: { | |
alias: { | |
'ignored-module': false, | |
'./ignored-module': false, | |
}, | |
}, | |
}; | |
``` |
But null-loader
can also use regexps to drop files, like this:
module.exports = {
//...
module: {
rules: [
{
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
use: 'null-loader'
},
]
},
};
It would be helpful if the resolve.alias
documentation could give an example of how to handle such a case. I think that the following would be the appropriate replacement, but I am far from certain that the resolver treats the alias as a regexp:
module.exports = {
//...
resolve: {
alias: {
'\\.woff2(\\?v=\\d+\\.\\d+\\.\\d+)?$': false,
},
},
};
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
snitin315 commentedon Mar 22, 2024
resolve.alias
doesn't accept RegExp paths