JetBrains / svg-sprite-loader

Webpack loader for creating SVG sprites.
MIT License
2.02k stars 270 forks source link

v2.2.0 symbol.mount is not a function #378

Closed 719media closed 4 years ago

719media commented 4 years ago

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.

719media commented 4 years ago

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.

s100 commented 4 years ago

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.

MagicHacker commented 4 years ago

me too!

Ignigena commented 4 years ago

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.

DarknessChaser commented 4 years ago

me too

kangning1206 commented 4 years ago

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

levenecav commented 4 years ago

I have the same problem.

kisenka commented 4 years ago

Fixed in svg-sprite-loader@4.2.1