Почему svgo-loader выдает ошибку?

74
15 июля 2021, 16:10

Имеется такой 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:\Users\Lenovo\Desktop\Webpack\node_modules\svgo-loader\index.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

В чем может быть дело?

READ ALSO
Node.js Как сделать получение аргументов

Node.js Как сделать получение аргументов

Я пишу бота на Дискорд, но не могу понять, как сделать прием аргументов, типа пользователь вводит "!отправить коины (кол-во) (uid)"Как получить...

99
Как вытащить значение из state?

Как вытащить значение из state?

Новичек в React, застопорился на данном моментеНужно при клике на объект, вытащить соответствующие значение из state

281