Svg-sprite-loader: v2.2.0 symbol.mount is not a function

Created on 25 Jan 2020  ·  8Comments  ·  Source: JetBrains/svg-sprite-loader

When updating from 4.1.6 to 4.2.0, I get the following error in the browser:

Uncaught TypeError: symbol.mount is not a function

my webpack rule is straightforward:

{
    test: /\.svg$/,
    use: [
      {
        loader: 'svg-sprite-loader',
        options: {
          symbolId: 'icon-[name]',
          extract: false
        }
      }
    ]
  }

and I am including the plugin

const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');

module.exports = {
...
  plugins: [
    new SpriteLoaderPlugin(),
  ]
...
}

All I've changed is the svg-sprite-loader version for this behavior to happen.

Most helpful comment

I am experiencing an identical-looking issue, however, for me the latest working version of svg-sprite-loader is 4.1.6 and the first broken version is 4.2.0.

All 8 comments

In the generated code I can see that the function was completely deleted:

-  BrowserSpriteSymbol.prototype.mount = function mount (target) {
-    if (this.isMounted) {
-      return this.node;
-    }
-
-    var mountTarget = typeof target === 'string' ? document.querySelector(target) : target;
-    var node = this.render();
-    this.node = node;
-
-    mountTarget.appendChild(node);
-
-    return node;
-  };

But I'm not sure why. Only change was the package.json version of this package from 2.1.7 to 2.2.0 for this break to happen.

I am experiencing an identical-looking issue, however, for me the latest working version of svg-sprite-loader is 4.1.6 and the first broken version is 4.2.0.

me too!

Hitting this issue as well. Updating to 4.2.0 breaks with the sybmol.mount is not a function error above and downgrading back to 4.1.6 fixes the issue.

For what it's worth, we have this running on several Vue projects using the same configuration (mostly default autoconfigure settings from the installation docs here). 4.2.0 seems to work on our projects that are only frontend builds and is only breaking in this way on the isomorphic builds.

me too

目前降级安装 4.1.6 版本,4.2.0有bug;

I have the same problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

suamikim picture suamikim  ·  5Comments

no-more picture no-more  ·  7Comments

hongkongk picture hongkongk  ·  3Comments

evgenyrodionov picture evgenyrodionov  ·  4Comments

timkelty picture timkelty  ·  7Comments