Error: Non-whitespace before first tag
See original GitHub issueSorry to raise an issue with this name again, but I believe that this is not related to the BOM issue that was closed previously. I am wondering if I am doing something silly with my webpack config that is causing this:
WARNING in ./shared/components/svg-icon/icons/twitter.svg
Module build failed: Error: Non-whitespace before first tag.
Line: 0
Column: 1
Char: m
at error (blah/node_modules/xml2js/node_modules/sax/lib/sax.js:651:10)
at strictFail (blah/node_modules/xml2js/node_modules/sax/lib/sax.js:677:7)
at beginWhiteSpace (blah/node_modules/xml2js/node_modules/sax/lib/sax.js:951:7)
at Object.write (blah/node_modules/xml2js/node_modules/sax/lib/sax.js:1006:11)
at Parser.exports.Parser.Parser.parseString (blah/node_modules/xml2js/lib/xml2js.js:508:31)
at Parser.parseString (blah/node_modules/xml2js/lib/xml2js.js:7:59)
at AnonymousObservable.__subscribe (blah/node_modules/svg-react-loader/lib/xml/parse.js:16:16)
at AnonymousObservable.tryCatcher (blah/node_modules/svg-react-loader/node_modules/rx/dist/rx.js:63:31)
at setDisposable (blah/node_modules/svg-react-loader/node_modules/rx/dist/rx.js:5845:44)
at AnonymousObservable.Rx.AnonymousObservable.AnonymousObservable._subscribe (blah/node_modules/svg-react-loader/node_modules/rx/dist/rx.js:5862:9)
So you’ll notice the char it comes across is an ‘m’, so I decided to see what it was seeing and logged out before this line svg-react-loader/lib/xml/parse.js:16:16
and got this:
module.exports = __webpack_public_path__ + "d9fb6acead094090c1450fa6f4b6c5b7.svg";
It seems that the loader has already done its magic by this point. So why am I getting this warning? Is it running twice? This is how my loader is configured:
{
test: /\.svg$/,
loader: 'svg-react-loader',
},
Any help would be appreciated. Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:11
- Comments:7
Top Results From Across the Web
Non-whitespace before first tag in xmls2js · Issue #345 - GitHub
@fxlemire I have a feed Reader that I created for RDF, ATOM as well as RSS. It works fine for all three but...
Read more >Error: Non-whitespace before first tag. Line: 0 Column: 1 Char: 4
The culprit is the so-called Byte-Order-Mark (BOM), a 3-byte “Zero width no-break space” Unicode character which Windows systems automatically ...
Read more >xml2js.js / sax.js: Non-whitespace before first tag - APImock
When looking into the XML directly and testing it e.g. with an XML validator everything seems fine. Turns out the culprit is the...
Read more >How to parse XML from URL – problem with encoding
ERROR: Non-whitespace before first tag. Line: 0 Column: 1 Char: . I assume the problem is with encoding. Here are my two...
Read more >Error: Non-whitespace before first tag. – Help Center - ABBYY
Hello, I need your help, I'm using processDocument Method for the JS example from GitHub...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
this may be and old thread but I came across this same error, make sure you set a defined loader for the file. Especially if you have other loaders with svg definitions
I had this same issue but am using a root import plugin, so mine ended up looking like:
(note the 2nd bang ‘!’ after ‘-svg-react-loader’)