svg-sprite-loader icon indicating copy to clipboard operation
svg-sprite-loader copied to clipboard

Regression, `sprite.stringify()` returns no symbols in 4.1.6 when 4.1.3 works ok

Open hinok opened this issue 6 years ago • 2 comments

Do you want to request a feature, report a bug or ask a question? Report a bug

What is the current behavior?

After upgrading to v4.1.6, calling sprite.stringify() returns no symbols. It works without issues with v4.1.3.

What is the expected behavior?

sprite.stringify() should return stringified symbols.

Part of webpack config for svg-sprite-loader

if (env.serverSideRendering || env.storybook) {
    return {
      module: {
        rules: [
          {
            test: /.*\.svg$/i,
            use: 'svg-sprite-loader',
            include: /assets\/glyphs/,
            exclude: /node_modules/,
          },
        ],
      },
    };
  }

  // For client bundle, we don't want to store contents of SVG files
  // therefore we use extract mode to provide only "minimal" amount
  // of data about SVG files (viewbox, id and url)
  // @see https://github.com/kisenka/svg-sprite-loader#extract-configuration
  return {
    module: {
      rules: [
        {
          test: /.*\.svg$/i,
          loader: 'svg-sprite-loader',
          include: /assets\/glyphs/,
          exclude: /node_modules/,
          options: {
            extract: true,
            runtimeGenerator: require.resolve('./svgRuntimeGenerator'),
          },
        },
      ],
    },
    plugins: [
      new SpriteLoaderPlugin({ plainSprite: true }),
    ],
  };

Please tell us about your environment:

  • Node.js version: 8.11.3?
  • webpack version: 4.38.0?
  • svg-sprite-loader version: 4.1.6
  • OS type & version: macOS 10.14.5

hinok avatar Jul 31 '19 18:07 hinok

Same question when execute SSR in nodejs. I believe this problem was introduced in PR #345 which used absolute path when import sprite.build. I have never used yarn before so I'm not able to fix it, @bimbiltu do you have any time to have a look at this bug?

ydfzgyj avatar Nov 06 '19 08:11 ydfzgyj

After 4.1.3 give Error. After 5.0.0 no Error, but return no symbols (server side).

I perform the actions according to the instructions. Can you update it then?

RikoRodriges avatar Jul 02 '21 17:07 RikoRodriges