0

Im relatively new to all of this and have been struggling getting my fonts to be included into my style.css.

At first it was not loading the files due to the path being incorrect (apparently it was looking for relative path from root rather than within the fonts directory itself)

Not it seems to find the files but tells me I am using the wrong loader. See Below:

module: {
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /(node_modules|bower_components)/,
        loader: 'babel-loader',
        query: {
          presets: ['react', 'es2015', 'stage-0'],
          plugins: ['react-html-attrs', 'transform-class-properties', 'transform-decorators-legacy'],
        }
      },
      {
        test: /\.scss?$/,
        loader: ExtractTextPlugin.extract('css!sass')
      },
      {
        test: /\.(png|woff|woff2|eot|ttf|svg)$/,
        loader: 'url-loader?limit=100000'
      }
    ]
  },

The error I get is the following: enter image description here

Any help is appreciated.

Stefan
  • 772
  • 4
  • 9
  • 22
  • BTW I am not sure why it says "Cannot find module... main.scss" if I remove the @import for the fonts it finds it just fine... – Stefan Feb 28 '16 at 20:01

1 Answers1

0

You sure it is url-loader but not file-loader ?

Because url-loader uses dataUrls and file-loader emits files.

Let's try the following and see it that works ~

{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&minetype=application/font-woff" }, { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }

R.R
  • 847
  • 1
  • 9
  • 20
  • No luck, strangely enough though this did solve another problem I was having within my fonts directory where the relative paths were not exactly correct. But otherwise same error: "Module parse failed: ... Line 1: Unexpected token ILLEGAL ... You may need an appropriate loader to handle this file type." – Stefan Mar 01 '16 at 00:56