gowravshekar / font-awesome-webpack

font-awesome package for webpack
MIT License
192 stars 49 forks source link

svg loader issue - Invalid tag #36

Closed santaclauze closed 7 years ago

santaclauze commented 7 years ago

I know this topic has been widely discussed but I have yet to find a similar issue or appropriate fix.

Version: "font-awesome-webpack": "0.0.5-beta.2", All my packages are up to date.

  1. I have imported font-awesome-webpack as the readme directs:
import 'font-awesome-webpack';
  1. I have added the webpack config loader:

    module.exports = {
    module: {
    loaders: [
      // the url-loader uses DataUrls. 
      // the file-loader emits files. 
      { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" },
      { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }
    ]
    }
    };
  2. I have inline-svgs that work fine with my project and are configurated in webpack with:

 {
      test: /\.svg$/,
      loaders: [
        'babel-loader',
        {
          loader: 'react-svg-loader',
          query: {
            jsx: true,
          },
        },
      ],
    }
  1. When I launch the project it displays the following error msg:
invariant.js:44 Uncaught (in promise) Error: Invalid tag: /f01bf49c263128347d1c47cdc55eff66.svg
    at invariant (invariant.js:44)
    at validateDangerousTag (ReactDOMComponent.js:340)
    at new ReactDOMComponent (ReactDOMComponent.js:367)
    at Object.createInternalComponent (ReactHostComponent.js:41)
    at instantiateReactComponent (instantiateReactComponent.js:79)
    at instantiateChild (ReactChildReconciler.js:44)
    at eval (ReactChildReconciler.js:71)
    at traverseAllChildrenImpl (traverseAllChildren.js:77)
    at traverseAllChildrenImpl (traverseAllChildren.js:93)
    at traverseAllChildren (traverseAllChildren.js:172)
  1. If I remove the webpack config suggested by font-awesome-webpack, my inline-svgs are displayed fine but the font-awesome icons are replaced by small empty squares.

I have been attempting various different webpack config possibilities without any success, or to delete one config to keep only one but I find myself in teh same scenarios described above. Either I have the console error and no display of the project, or the display is fine apart form the font-awesome that display empty squares.

What am I doing wrong?

santaclauze commented 7 years ago

Found a solution without font-awesome-webpack -_-