Содержание
- Error: Non-whitespace before first tag #84
- Comments
- Error in parsing SVG: Non-whitespace before first tag about svgo-loader HOT 8 CLOSED
- Comments (8)
- Related Issues (20)
- Recommend Projects
- React
- Vue.js
- Typescript
- TensorFlow
- Django
- Laravel
- Recommend Topics
- javascript
- server
- Machine learning
- Visualization
- Recommend Org
- Microsoft
- «Non-whitespace before first tag.» error #123
- Comments
- Footer
- Syntax Error: NonErrorEmittedError: (Emitted value instead of an instance of Error) Error in parsing SVG: Non-whitespace before first tag. #177
- Comments
- Error in parsing SVG: Non-whitespace before first tag. about svgo-loader HOT 3 CLOSED
- Comments (3)
- Related Issues (20)
- Recommend Projects
- React
- Vue.js
- Typescript
- TensorFlow
- Django
- Laravel
- Recommend Topics
- javascript
- server
- Machine learning
- Visualization
- Recommend Org
- Microsoft
Error: Non-whitespace before first tag #84
Sorry 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:
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:
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:
Any help would be appreciated. Thanks!
The text was updated successfully, but these errors were encountered:
this is raised by sax parser , the module analysing your svg.
It seems it has encountered a char it doesn’t appreciate
i encourage you to open your svg with a good text editor like notepad++, and activate option to see all invisible white chars. You’ll be able to see incriminated char and shoot it.
try again after this
See, I don’t think that’s the case. The problem is that the parser is literally coming across this string:
module.exports = __webpack_public_path__ + «d9fb6acead094090c1450fa6f4b6c5b7.svg»; which is why it sees an m as the first character. I imagine that the parser would normally expect to see something like at that time. The problem is not in invisible chars, it is that the transformation seems to have already happened before the parser runs?
And fwiw I did save my files as UTF-8 encoding without BOM to eliminate that as the reason.
ok so it pay comes from the order of your loaders for svg files. I have had this issue before.
you can see if you have any loader out of svg-react-loader in your config, and eventually exclude svg from it.
moreover do no not forget loaders are called in the inverse order of lines in your webpack.config file
@nebaff that was the solution for me, I needed to move my svg-react-loader test under my fallback svg loader. I was under the impression that my loaders applied in the opposite order. Thank you!
Источник
Error in parsing SVG: Non-whitespace before first tag about svgo-loader HOT 8 CLOSED
Hi @jawn-ha . Could you provide svg file which produces this error?
jawn-ha commented on January 16, 2023
Hi @jawn-ha . Could you provide svg file which produces this error?
this is the svg icons
svg_icon.zip
TrySound commented on January 16, 2023
Cannot reproduce. Could you create repository with reproduction including webpack setup?
jawn-ha commented on January 16, 2023
Cannot reproduce. Could you create repository with reproduction including webpack setup?
I create an repo to reproduce the question https://github.com/jawn-ha/svgo-test.
You can clone and run npm install and npm run serve to reproduce
TrySound commented on January 16, 2023
I see. It’s not svgo-loader issue. Put svg-sprite-loader before svgo-loader. It’s stupid webpack loaders ordering.
jawn-ha commented on January 16, 2023
I had tried this,if you put svg-sprite-loader before svgo-loader, svgo-loader will not working
I see. It’s not svgo-loader issue. Put svg-sprite-loader before svgo-loader. It’s stupid webpack loaders ordering.
TrySound commented on January 16, 2023
I don’t see any issue with svgo. It produces correct svg, it removes fill from path. Maybe something wrong with svg-sprite-loader. I’m not experienced with it.
jawn-ha commented on January 16, 2023
I have solved it, you are right! The cause of the problem is my SVGO config is wrong. Thanks for your patience
I don’t see any issue with svgo. It produces correct svg, it removes fill from path. Maybe something wrong with svg-sprite-loader. I’m not experienced with it.
- svgo dependency resolves as v0.7.2 with svgo-loader v2.0.0 HOT 15
- TypeError: callback is not a function HOT 7
- Error in parsing SVG: Non-whitespace before first tag. HOT 3
- Module build failed: TypeError: callback is not a function HOT 1
- Load config from svgoConfig.yml file? HOT 5
- Does svgo-loader cache result? HOT 2
- feature request: Append config to imported external config HOT 1
- option: pretty true not honored HOT 1
- Issues: when using loader multiple times problems occur (+solution) HOT 2
- SVGO v2 HOT 7
- svgo loader multiple versions breaks extendDefaultPlugins HOT 1
- Webpack 5 | Error: Plugin name should be specified HOT 3
- Cannot configure the svgo-loader
- why not image-webpack-loader? HOT 1
- Publish new release to npm with svgo 2.5.0 HOT 2
- Webpack ignores svgo-loader HOT 3
- Please help to update loader-utils for fixing the vulnerability HOT 3
- What versions of webpack does `svgo-loader` support? HOT 6
- SVGO v3.0.0 support HOT 1
Recommend Projects
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
TensorFlow
An Open Source Machine Learning Framework for Everyone
Django
The Web framework for perfectionists with deadlines.
Laravel
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
Recommend Topics
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
server
A server is a program made to process requests and deliver data to clients.
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Visualization
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
Recommend Org
We are working to build community through open source technology. NB: members must have two-factor auth.
Microsoft
Open source projects and samples from Microsoft.
Источник
«Non-whitespace before first tag.» error #123
did $ svgo logo.svg
got Non-whitespace before first tag
Did not find any info anywhere about this error msg. Can somebody give me a clue?
Thanks.
The text was updated successfully, but these errors were encountered:
this is a sax parser error, looks like you have an invalid-non-well-formed SVG (XML) file.
i have nothing to do with it because this error is not directly related to svgo.
please try to validate your file with XML Validator.
if all else fails then write here again with the link to your file.
Syntax-check was ok.
So I thought the export from Illustrator is wrong somehow.
This was my original export settings from Illustrator:
( settings based on http://stackoverflow.com/questions/13236365/optimal-settings-for-exporting-svgs-for-the-web-from-illustrator )
I tried different export settings and it is working now.
My new settings:
Thank you for your help (and the tool) and sorry for being out-of-topic.
glad you figured it out 🙂
I have also had this issue. For me it was caused by the SVG file starting with a BOM symbol (https://en.wikipedia.org/wiki/Byte_order_mark) as it was a UTF-8 file. If you open the file and change the encoding and resave (e.g. with notepad2) it should remove the symbol and then the file should work.
thanks for the report.
i think that we should create an issue in sax-js
I’m a bit late to the party but had the same issue as @PedroNorte. In PhpStorm theres a context menu item called Remove BOM which solved the problem for me.
Same here on SVG’s which are run through svgo beforehand.
I double checked to have BOM removed and I check my files with an xml validator.
Actually it is very weird, it works with my svgo CLI, but webpack’s svgo-loader fails
Edit
My Problem was caused by another svg loader for custom fonts.
In my case I realized, that create-react-app have already good svg loader inside: svgr
And it’s working out of the box:
© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
Syntax Error: NonErrorEmittedError: (Emitted value instead of an instance of Error) Error in parsing SVG: Non-whitespace before first tag. #177
error in ./src/assets/logo.svg?inline
Syntax Error: NonErrorEmittedError: (Emitted value instead of an instance of Error) Error in parsing SVG: Non-whitespace before first tag.
Line: 0
Column: 1
Char: m
@ ./node_modules/cache-loader/dist/cjs.js??ref—13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref—1-0!./node_modules/vue-loader-v16/dist??ref—1-1!./src/layouts/BasicLayout.vue?vue
&type=script&lang=js 12:0-48 19:13-20
@ ./src/layouts/BasicLayout.vue?vue&type=script&lang=js
@ ./src/layouts/BasicLayout.vue
@ ./src/layouts/index.js
@ ./src/config/router.config.js
@ ./src/router/index.js
@ ./src/globalApp.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://192.168.2.82:8001&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
vue.config.js config:
const svgRule = config.module.rule(‘svg’)
svgRule.uses.clear()
svgRule
.oneOf(‘inline’)
.resourceQuery(/inline/)
.use(‘vue-loader’)
.loader(‘vue-loader’)
.end()
.use(‘vue-svg-loader’)
.loader(‘vue-svg-loader’)
.end()
module version:
«vue»: «^3.2.26»,
«vue-svg-loader»: «0.17.0-beta.2»
The text was updated successfully, but these errors were encountered:
Источник
Error in parsing SVG: Non-whitespace before first tag. about svgo-loader HOT 3 CLOSED
Could you tell me what the right repo is? I’m having the same issue and am having a hard time finding a solution.
JamesTheHacker commented on January 16, 2023
Sorry filed the issue on the wrong repo. Closing.
jldamas commented on January 16, 2023
- svgo dependency resolves as v0.7.2 with svgo-loader v2.0.0 HOT 15
- TypeError: callback is not a function HOT 7
- Module build failed: TypeError: callback is not a function HOT 1
- Load config from svgoConfig.yml file? HOT 5
- Does svgo-loader cache result? HOT 2
- feature request: Append config to imported external config HOT 1
- option: pretty true not honored HOT 1
- Issues: when using loader multiple times problems occur (+solution) HOT 2
- SVGO v2 HOT 7
- Error in parsing SVG: Non-whitespace before first tag HOT 8
- svgo loader multiple versions breaks extendDefaultPlugins HOT 1
- Webpack 5 | Error: Plugin name should be specified HOT 3
- Cannot configure the svgo-loader
- why not image-webpack-loader? HOT 1
- Publish new release to npm with svgo 2.5.0 HOT 2
- Webpack ignores svgo-loader HOT 3
- Please help to update loader-utils for fixing the vulnerability HOT 3
- What versions of webpack does `svgo-loader` support? HOT 6
- SVGO v3.0.0 support HOT 1
Recommend Projects
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
TensorFlow
An Open Source Machine Learning Framework for Everyone
Django
The Web framework for perfectionists with deadlines.
Laravel
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
Recommend Topics
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
server
A server is a program made to process requests and deliver data to clients.
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Visualization
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
Recommend Org
We are working to build community through open source technology. NB: members must have two-factor auth.
Microsoft
Open source projects and samples from Microsoft.
Источник
Имеется такой SVG файл.
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<symbol id='logo' viewBox="0 0 500 500">
<path d="M107.42,331.9a24.31,24.31,0,0,1-9.29-9.1,26.69,26.69,0,0,1,0-26,24.31,24.31,0,0,1,9.29-9.1,26.47,26.47,0,0,1,13.18-3.32,27.62,27.62,0,0,1,9.54,1.62,20.6,20.6,0,0,1,7.59,4.79l-.86,1q-6.35-6-16.27-6.05a24.73,24.73,0,0,0-12.42,3.17,23.26,23.26,0,0,0-8.79,8.68,24.86,24.86,0,0,0,0,24.4,23.26,23.26,0,0,0,8.79,8.68,24.73,24.73,0,0,0,12.42,3.17q9.86,0,16.27-6.12l.86,1a20.83,20.83,0,0,1-7.63,4.82,27,27,0,0,1-9.5,1.66A26.47,26.47,0,0,1,107.42,331.9Z" />
<path d="M152.6,332.8a16.93,16.93,0,0,1-6.48-6.73,20.07,20.07,0,0,1-2.34-9.72,19.84,19.84,0,0,1,2.34-9.68,17,17,0,0,1,6.48-6.7,19,19,0,0,1,18.5,0,17,17,0,0,1,6.48,6.7,19.84,19.84,0,0,1,2.34,9.68,20.07,20.07,0,0,1-2.34,9.72,16.93,16.93,0,0,1-6.48,6.73,18.89,18.89,0,0,1-18.5,0Zm17.75-1.18a15.78,15.78,0,0,0,6-6.23,20,20,0,0,0,0-18.07,15.5,15.5,0,0,0-6-6.2,17.57,17.57,0,0,0-17,0,15.46,15.46,0,0,0-6,6.2,20,20,0,0,0,0,18.07,15.73,15.73,0,0,0,6,6.23,17.3,17.3,0,0,0,17,0Z" />
<path d="M198.86,300.12a16,16,0,0,1,9.29-2.56V299h-.43q-6.71,0-10.44,4.28T193.53,315v20h-1.44V297.78h1.44v9.64A13.83,13.83,0,0,1,198.86,300.12Z" />
<path d="M246.2,300a17.21,17.21,0,0,1,6.51,6.73,21,21,0,0,1,0,19.41,17.23,17.23,0,0,1-6.51,6.69,17.89,17.89,0,0,1-9.18,2.42,17.52,17.52,0,0,1-10.26-3.14,16.82,16.82,0,0,1-6.37-8.38V349H219V297.78h1.44v11.37a17,17,0,0,1,6.33-8.46,17.48,17.48,0,0,1,10.3-3.13A17.88,17.88,0,0,1,246.2,300Zm-.68,31.68a15.48,15.48,0,0,0,6-6.19,20,20,0,0,0,0-18.07,15.71,15.71,0,0,0-6-6.23,17.31,17.31,0,0,0-17,0,15.71,15.71,0,0,0-6,6.23,20,20,0,0,0,0,18.07,15.48,15.48,0,0,0,6,6.19,17.52,17.52,0,0,0,17,0Z" />
<path d="M262.79,334.64a1.8,1.8,0,0,1-.57-1.3,1.77,1.77,0,0,1,.57-1.33,1.87,1.87,0,0,1,1.3-.54,1.84,1.84,0,0,1,1.87,1.87,1.85,1.85,0,0,1-.54,1.3,1.76,1.76,0,0,1-1.33.58A1.83,1.83,0,0,1,262.79,334.64Z" />
<path d="M280.22,284.6h1.44v49h30V335H280.22Z" />
<path d="M350.06,316.35H316.94a18.22,18.22,0,0,0,2.23,9,16,16,0,0,0,6.16,6.23,18.33,18.33,0,0,0,16,.75,13.89,13.89,0,0,0,5.51-4.28l1,1a16.3,16.3,0,0,1-6.05,4.53,19.6,19.6,0,0,1-17.17-.83,17.3,17.3,0,0,1-6.63-6.73,19.57,19.57,0,0,1-2.41-9.72,20.59,20.59,0,0,1,2.23-9.68A16.77,16.77,0,0,1,324,300a16.45,16.45,0,0,1,8.82-2.41,16.82,16.82,0,0,1,15,8.93,19.59,19.59,0,0,1,2.27,9.5ZM324.93,301a15.62,15.62,0,0,0-5.65,5.76,17.69,17.69,0,0,0-2.34,8.2h31.75a17.49,17.49,0,0,0-2.38-8.2,15.85,15.85,0,0,0-5.68-5.76,15.79,15.79,0,0,0-15.7,0Z" />
<path d="M384.83,335l-14-18.22L356.68,335h-1.8l15-19.3-14.11-17.92h1.79l13.18,16.92,13.18-16.92h1.73L371.58,315.7,386.71,335Z" />
<path d="M383,348.28l-34.89,2.38q-17.46,1.06-34.92,2t-34.94,1.68c-11.65.46-23.3.9-35,.87-5.86-.11-11.67-.49-17.49-.8l-17.46-.93q-17.46-.9-34.93-1.6c-11.65-.45-23.3-.81-34.95-1l-8.74-.09c-2.92,0-5.83,0-8.74.05s-5.83.09-8.74.28c-1.45.1-2.91.12-4.36.27l-4.35.45,4.34-.51c1.45-.17,2.91-.22,4.36-.33,2.91-.24,5.83-.28,8.74-.41s5.83-.11,8.74-.17l8.75,0c11.66.08,23.32.4,35,.79s23.31.88,34.95,1.43l17.47.84c5.82.29,11.65.64,17.45.72,11.64.09,23.3-.29,34.94-.7s23.29-.94,34.94-1.51l34.92-1.83Z" />
</symbol>
</svg>
Вот таким образом SVG обрабатывается в webpack:
{
test: /.svg$/,
use: [
{
loader: 'file-loader',
options: {
name: "img/[name].[ext]",
}
},
{
loader: 'svgo-loader',
options: {
plugins: [
{removeTitle: true},
]
}
}
]
},
Таким образом импортирую файл:import './img/sprite.svg';
И по какой-то причине получаю такую ошибку:
ERROR in ./src/img/sprite.svg
Module build failed (from ./node_modules/svgo-loader/index.js):
Error: Error in parsing SVG: Non-whitespace before first tag.
Line: 0
Column: 1
Char: m
at C:UsersLenovoDesktopWebpacknode_modulessvgo-loaderindex.js:63:14
at
at runMicrotasksCallback (internal/process/next_tick.js:121:5)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
@ ./src/index.js 9:0-26
В чем может быть проблема?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.