小编mar*_*ich的帖子

找不到模块“@fortawesome/react-fontawesome”

当我构建项目时,出现错误:找不到模块“@fortawesome/react-fontawesome”。您的意思是将“moduleResolution”选项设置为“node”,还是将别名添加到“paths”选项?

软件包是用纱线安装的,如下所示https://fontawesome.com/docs/web/use-with/react/

在脚本中导入:

import * as React from 'react';
import Select from 'react-select';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
Run Code Online (Sandbox Code Playgroud)

webpack.config.js

var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  mode: 'development',

  entry: {
    task_creator: "./src/service.tsx"
  },

  output: {
    filename: '[name].js'
  },
  resolve: {
    modules:[
      path.resolve(__dirname, 'src'),
      'node_modules',
    ],
    extensions: ['.ts', '.tsx', '.js'],
  },
  module: {
      rules: [
        {
          test: /\.tsx$/, loader: 'ts-loader'
        },
        {
          test: /\.css$/,
          use: ['style-loader', 'css-loader']
        },
        {
          test: /\.(png|woff|woff2|eot|ttf|svg)$/,
          loader: 'url-loader'
        }
      ] …
Run Code Online (Sandbox Code Playgroud)

javascript font-awesome reactjs

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

标签 统计

font-awesome ×1

javascript ×1

reactjs ×1