boopathi/react-svg-loader

Doesn't work in Edge

andrecalvo opened this issue · 2 comments

When using the loader like so to load an inline SVG...
import AlertIcon from "-!react-svg-loader!images/foo.svg;

Edge errors as it can't understand the rest/spread syntax.

tf commented

Using the rollup variant of this loader, I needed to configure the babel plugin to also compile files with svg extension to make it work:

plugins: [
  babel({
    exclude: 'node_modules/**',
    extensions: ['js', 'jsx', 'svg']
  }),
  resolve(),
  commonjs(),
  reactSvg({
    svgo: {multipass: true}
  })
]

Agree. The build export should be a traditional ESM (ES5 + import/export).