webpack 2 expected '!' error using with import

Viewed 11705

I want to use this svg loader, https://github.com/jhamlet/svg-react-loader

in the instruction I followed the usage, like

import Logo from 'svg-react-loader?name=Logo!../images/logo.svg';

But I got error

Line 3:  Unexpected '!' in 'svg-react-loader?name=Logo!../images/logo.svg'. Do not use import syntax to configure webpack loaders  import/no-webpack-loader-syntax
2 Answers

easier and safer solution is to add the following line to the file where you want to use the inline loaders:

/* eslint import/no-webpack-loader-syntax: off */

this will switch this option only for the file that includes this line.

Related