sourcemapper icon indicating copy to clipboard operation
sourcemapper copied to clipboard

SVGs are not properly extracted

Open mrdc opened this issue 2 years ago • 1 comments

Hello,

I've found an issue with embedded SVGs - they are broken and inside I see js code (this is an example):

var _path;

var _excluded = ["svgRef", "title"];

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

import React from "react";

var svgArrowBack = function svgArrowBack(_ref) {
  var svgRef = _ref.svgRef,
      title = _ref.title,
      props = _objectWithoutProperties(_ref, _excluded);

  return /*#__PURE__*/React.createElement("svg", _extends({
    width: 16,
    height: 8,
    viewBox: "0 0 16 8",
    fill: "none",
    ref: svgRef
  }, props), title ? /*#__PURE__*/React.createElement("title", null, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
    d: "M3.13 5.22C2.758 4.776 2.368 4.392 1.96 4.068C1.564 3.732 1.144 3.456 0.7 3.24V2.466C1.588 2.01 2.398 1.344 3.13 0.467999H4.516C4.288 1.068 4 1.614 3.652 2.106H13.3V3.582H3.652C3.976 4.05 4.264 4.596 4.516 5.22H3.13Z",
    fill: "black"
  })));
};

var ForwardRef = /*#__PURE__*/React.forwardRef(function (props, ref) {
  return /*#__PURE__*/React.createElement(svgArrowBack, _extends({
    svgRef: ref
  }, props));
});
export default __webpack_public_path__ + "static/media/arrow_back.fg3125e2.svg";
export { ForwardRef as ReactComponent };

Is it expected behaviour?

mrdc avatar Aug 13 '22 09:08 mrdc

Sourcemapper doesnt have any specific logic to deal with SVGs, it only unpacks whatever is in the source map. Does this match whats in your browser developer console?

denandz avatar Aug 14 '22 00:08 denandz

Without more info on the issue and what the source map should be exported to, there isn't much I can do here. Closing the issue, can re-open if more information is added.

denandz avatar Nov 20 '22 23:11 denandz