- Ignore babel config files during transformation #264
- Fix
package.json
version updates (27bce4a)
- Drop Node 6. Run tests on Node 8, 10, and 12
- Upgrade dependencies
Fixes:
- Close svgo object instead of mutating it (#250)
- Compatibility between babel 6 and 7 for
t.restElement
andt.restProperty
(#244) - Update to use fully resolved paths for babel plugins (#209)
Two new packages -
- react-svg-core - shared between webpack loader and rollup plugin
- rollup-plugin-react-svg - rollup plugin to load
.svg
files as react components
Tests are run on Node 4, 6, and 8
Previously, the output of the react-svg-loader was -
import React from "react";
export default class SVG extends React.Component {
render() {
return <svg {...this.props}>{svgContent}</svg>;
}
}
and now it is -
import React from "react";
export default props => <svg {...props}>{svgContent}</svg>;
Previously, class values are NOT transformed. Now they are transformed such that the output component can be used with css-modules
<svg class="foo bar">
is transformed to
<svg className={ (styles["foo"] || "foo") + " " + (styles["bar"] || "bar") }>
So, you can pass/override some styles in the svg, for example -
import Image from "react-svg-loader!./image.svg";
import styles from "./styles.css"; // with css-modules
const imageStyles = {
foo: styles.foo,
bar: styles.bar
};
let component = <Image styles={imageStyles} />;
Previously, you could do,
{
loader: "react-svg-loader",
options: {
es5: true
}
}
and get output transpiled to ES5 using babel-preset-es2015.
This is now deprecated and the recommended way to use react-svg-loader is to use it with babel-loader
{
test: /\.svg$/,
use: [
"babel-loader",
"react-svg-loader"
]
}
and with babel-preset-env in .babelrc
:
{
"presets": [
[
"env",
{
"target": {
"browsers": "IE > 11"
}
}
]
]
}
Now react-svg-loader is split into 3 packages