question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module 'svg-baker-runtime/symbol'

See original GitHub issue

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

What is the current behavior? Error: Cannot find module ‘svg-baker-runtime/symbol’

I have submodule (kit for component) and main project. I tested svg-sprite-loader in kit and it was ok. Then I added this rules to main project ( https://gist.github.com/pSHCH/cb03ff5469df85439f4fe42969430330 ).

My component in kit:

import React from 'react';
import user from './img/user.svg';

var svg = {
  user
};

function Icon(props) {
  return <i>
    <svg className={st['icon-path']} viewBox={svg[props.type].viewBox}>
      <use xlinkHref={'#${svg[props.type].id}'}/>
    </svg>
  </i>;
}

export default Icon;

and use at page:

<Icon type='user'/>

What is the expected behavior?

If the current behavior is a bug, please provide the steps to reproduce, at least part of webpack config with loader configuration and piece of your code. The best way is to create repo with minimal setup to demonstrate a problem (package.json, webpack config and your code). It you don’t want to create a repository - create a gist with multiple files

If this is a feature request, what is motivation or use case for changing the behavior?

Please tell us about your environment:

  • Node.js version: 7.4.0
  • webpack version: 2.2.0
  • svg-sprite-loader version: 3.2.4
  • OS type & version: OS X El Capitan

Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:25 (11 by maintainers)

github_iconTop GitHub Comments

4reactions
sunil-jhamnani-zzcommented, May 25, 2019

Was facing this issue with version 4.1.6. Downgraded this to version 4.1.3 and it’s gone. Config I used:

{
        test: /\.svg$/,
        include: SVG_SPRITE_PATH_LIST,
        use: [
          {
            loader: 'svg-sprite-loader',
            options: {
              // Keeping false for now, this means that
              // SVG will be inlined with the JS. Ideally
              // it should be served separately via CDN.
              extract: false,
              // Creates sprite sheet for each type of SVG?
              spriteFilename: svgPath => `sprite-sheet${svgPath.substr(-4)}`,
            }
          },
          {
            loader: 'image-webpack-loader',
            options: {
              svgo: {
                removeComments: true,
                removeTitle: true,
                convertColors: {
                  shorthex: true
                }
              }
            }
          }
        ]
}
2reactions
semirartcommented, Apr 27, 2020

@kisenka Thank you! Here’s the repo.

You can bootstrap it like this:

yarn create next-app --example https://github.com/semirart/next-with-svg-sprites
# or
npm init next-app --example https://github.com/semirart/next-with-svg-sprites

To run the project:

yarn dev
# or
npm run dev
Read more comments on GitHub >

github_iconTop Results From Across the Web

How fix cannot find module 'svg-baker-runtime/symbol' in svg ...
I use svg-sprite-loader for one folder in project, so i have such config: module: { rules: [ { test: /\.(gif|png|jpg|jpeg|svg|ico)$/, ...
Read more >
svg-baker-runtime - npm
Start using svg-baker-runtime in your project by running `npm i svg-baker-runtime`. There are 42 other projects in the npm registry using ...
Read more >
https://raw.githubusercontent.com/kisenka/svg-spri...
<a name="6.0.11"></a> ## [6.0.11](https://github.com/JetBrains/svg-sprite-loader/compare/ ... **runtime-generator:** fix module not found errors for custom ...
Read more >
svg-sprite-loader | Yarn - Package Manager
Earlier context param was containing path to compilation root context, e.g. folder where webpack compilation occurs. This is wrong behaviour, because meaning of ......
Read more >
How To Import SVGs into NextJS | Frontend Digest
Cannot find module './Dog.svg' or it's corresponding type definitions. In order to resolve this error, start by creating a folder called @types in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found