In creating my art for my website, I have some intermediate files that I want to keep in my "media" folder.
But then webpack starts complaining that it does not know what to do with those files.
Is there an easy way to say, don't worry about any files with the .pdn
extension?
I tried these options in my webpack.config.js, and it did not help:
{ test: /\.pdn?$/, loader: 'raw', exclude: /.*/}
{ test: /\.pdn?$/, exclude: /.*/}
Actually, those 'include' and 'exclude' properties are telling the loaders whether to include/exclude the files described (such as the contents of node_modules ), not webpack itself.
Prevent generation of modules for import or require calls matching the following regular expressions: requestRegExp A RegExp to test the request against. contextRegExp (optional) A RegExp to test the context (directory) against.
Webpack enables use of loaders to preprocess files. This allows you to bundle any static resource way beyond JavaScript. You can easily write your own loaders using Node.
A webpack plugin is a JavaScript object that has an apply method. This apply method is called by the webpack compiler, giving access to the entire compilation lifecycle.
You could add the ignore-loader
plugin and match files to it.
Example (in webpack.config.js
)
This will ignore all .css
files.
module.exports = {
// ... other configurations ...
module: {
loaders: [
{ test: /\.css$/, loader: 'ignore-loader' }
]
}
};
I needed it since I was requiring some node_modules
that imported multiple font formats, but I only wanted woff
or woff2
formats.
My solution:
config = {
// ... config ...
module: [
{ test: /(\.woff|\.woff2)$/, loader: 'url?name=font/[name].[ext]&limit=10240&mimetype=application/font-woff' },
{ test: /\.ttf$/, loader: 'ignore-loader' },
{ test: /\.eot$/, loader: 'ignore-loader' }
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With