Svgr Versions Save

Transform SVGs into React components 🦁

v6.2.0

2 years ago

Bug Fixes

  • cli: pass in parser to prettier format to avoid deprecation warning (#662) (74fa3ae)
  • plugin-svgo: handle potential errors from optimize (#663) (7582d31)

Features

v6.1.2

2 years ago

Bug Fixes

  • specify valid peer deps (45a76ed)
  • rollup: missing dep & missing map return (#652) (12627fc)

v6.1.1

2 years ago

Bug Fixes

v6.1.0

2 years ago

Bug Fixes

Features

  • native: automatically convert inline style in native (138c493), closes #588

Performance Improvements

  • remove useless loader-utils package (387bc72), closes #631

v6.0.0

2 years ago

SVGR v6 uses SVGO v2 under the hood and includes tons of improvement. It also contains small breaking changes. In most cases you will have nothing to change. But be sure to check the migration guide.

Bug Fixes

  • fix XML entities in generated JavaScript (#553) (b3998eb)
  • formatExportName for single names (#548) (5decc94)
  • template: make it possible to use type in template (#619) (5966714), closes #556
  • webpack: fix webpack 5 behaviour with url-loader (1a8cc98)

Features

BREAKING CHANGES

  • Config format of SVGO changes & SVGR does not merge SVGO config
  • Template has a new format
  • core: @svgr/core now exposes { transform } instead of default export
  • using --icon as latest arg now requires "--"

v6.0.0-alpha.4

2 years ago

Features

BREAKING CHANGES

  • using --icon as latest arg now requires "--"

v6.0.0-alpha.2

2 years ago

Features

v6.0.0-alpha.3

2 years ago

Bug Fixes

  • template: make it possible to use type in template (#619) (5966714), closes #556
  • webpack: fix webpack 5 behaviour with url-loader (1a8cc98)

Code Refactoring

Features

BREAKING CHANGES

  • core: @svgr/core now exposes { transform } instead of default export.

v6.0.0-alpha.1

2 years ago

Bug Fixes

Features

BREAKING CHANGES

Templates

Template signature has changed, it is now much more simpler to create custom templates. Also you don't have to do anything specific to use TypeScript in your template. If you need some Babel specific things you have to import it by yourself.

v5.x

const template = (
  { template },
  opts,
  { imports, interfaces, componentName, props, jsx, exports }
) => {
  const plugins = ["jsx"];
  if (opts.typescript) {
    plugins.push("typescript");
  }
  const typeScriptTpl = template.smart({ plugins });
  return typeScriptTpl.ast`${imports}

${interfaces}

function ${componentName}(${props}) {
  return ${jsx};
}
${exports}
  `;
};

module.exports = template;

v6.x

const template = (variables, { tpl }) => {
  return tpl`
${variables.imports};

${variables.interfaces};

const ${variables.componentName} = (${variables.props}) => (
  ${variables.jsx}
);
 
${variables.exports};
`;
};

module.exports = template;

v6.0.0-alpha.0

2 years ago

Bug Fixes

  • fix XML entities in generated JavaScript (#553) (b3998eb)

Features

  • add option to explicitly use named export (#584) (f18ea80)
  • add TypeScript declarations to [@svgr](https://github.com/svgr)/core (#555) (681303a)
  • add webpack typescript preset configuration (#573) (16072d4)
  • upgrade to svgo v2 (1f107af)

BREAKING CHANGES

  • config format of SVGO changes & SVGR does not merge SVGO config.