相关疑难解决方法(0)

使用Webpack和font-face加载字体

我正在尝试使用CSS文件加载字体,@font-face但字体永远不会加载.这是我的目录结构.

在此输入图像描述

然后在webpack.config.js我有加载器来获取字体.

var path = require('path');
var webpack = require('webpack');

module.exports = {
  devtool: 'eval',
  entry: [
    "./index.js"
  ],
  output: {
    path: __dirname+"/build",
    filename: "main.js"
  },
  plugins: [
    new webpack.NoErrorsPlugin(),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin()
  ],
  resolve: {
    extensions: ['', '.js', '.jsx']
  },
  module: {
      loaders: [
          { test: /\.js$/, loaders: ['react-hot', 'babel-loader'], exclude: /node_modules/ },
          { test: /\.jsx?$/, loaders: ['react-hot', 'babel-loader'], exclude: /node_modules/ },
          { test: /\.svg$/, loader: "raw" },
          { test: /\.css$/, loader: "style-loader!css-loader" }, …
Run Code Online (Sandbox Code Playgroud)

css font-face node.js reactjs webpack

26
推荐指数
4
解决办法
3万
查看次数

标签 统计

css ×1

font-face ×1

node.js ×1

reactjs ×1

webpack ×1