This repository was archived by the owner on Dec 22, 2020. It is now read-only.

Description
In my project I'm using Font-Awessome (with scss-loader + file-loader) .... and everything goes fine, and the fonts are put into the proper directory. But I'm looking to "remove some fat" and keep just the .*woff2 files from all of font formats.
I've tried to use "null-loader" to "skip" all other fonts {test: /.(woff|eot|ttf|otf|svg)$/, use: "null-loader"} ... but while the font files are removed, this will corrupt the url() declaration into the generated css file resulting in url([object Object ]) kind of source ...
- Operating System: Windows
- Node Version: 9.11.1
- NPM Version: 5.8.0
- webpack Version: 4.6.0
- null-loader Version: 0.1.1
This issue is for a:
Code
webpack.config.js
// try to keep just woff2 font and remove all the others
{ test: /\.woff2$/, use: "file-loader?name=fonts/[name].[ext]" },
{ test: /\.(woff|eot|ttf|otf|svg)$/, use: "null-loader" }
Expected Behavior
- The fonts folder should include just fontawesome-webfont.woff2
- The generated .css should include just the src: url(fonts/fontawesome-webfont.woff2) format("woff2") declaration:
@font-face {
font-family: 'FontAwesome';
src: url(fonts/fontawesome-webfont.woff2) format("woff2")
font-weight: normal;
font-style: normal;
}
Actual Behavior
- This is 🆗 , so just the woff2 font file will be copied
- The generated .css will include for ALL non skipped formats an odd url name ( url([object Object]) ) instead of removing the declaration
@font-face {
font-family: 'FontAwesome';
src: url([object Object]);
src: url([object Object]) format("embedded-opentype"), url(fonts/fontawesome-webfont.woff2) format("woff2"), url([object Object]) format("woff"), url([object Object]) format("truetype"), url([object Object]) format("svg");
font-weight: normal;
font-style: normal;
}
How Do We Reproduce?
The project reproducing this issue is located here: http://www.github.com/cyparu/null_loader_css_url_bug
Steps to execute:
check build/index.css for wrongly generated CSS content