Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 使用webpack 4处理字体问题-React JS_Css_Reactjs_Webpack - Fatal编程技术网

Css 使用webpack 4处理字体问题-React JS

Css 使用webpack 4处理字体问题-React JS,css,reactjs,webpack,Css,Reactjs,Webpack,当我试图将我的csscss导入我的react时,我会出错。 我已经研究并尝试了许多可用的选项,但似乎没有任何效果 这是我的密码: const HtmlWebPackPlugin = require("html-webpack-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const CopyWebpackPlugin = require('copy-webpack-plugin'); cons

当我试图将我的
css
css导入我的react时,我会出错。 我已经研究并尝试了许多可用的选项,但似乎没有任何效果

这是我的密码:

const HtmlWebPackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');

module.exports = { 
    entry: './src/index.js', 
    output: { 
        path: path.resolve(__dirname, 'dist'), 
        filename: 'main.js', 
        publicPath: '/'
    }, 
    devServer: { 
        historyApiFallback: true,
        host: 'localhost', 
        port: 8080,
    }, 
    module: { 
        rules: [ 
            { 
                test: /\.(js|jsx)$/, 
                exclude: /node_modules/, 
                use: { 
                    loader: "babel-loader" 
                } 
            }, 
            { test: /\.html$/, 
                use: [ 
                    { 
                        loader: "html-loader", 
                        options: 
                        { 
                            minimize: true 
                        } 
                    } 
                ] 
            }, 
            { 
                test: /\.css$/, 
                use: [MiniCssExtractPlugin.loader, "css-loader"] 
            },
            {
                test: /\.scss$/,
                use: [
                    "style-loader", 
                    "css-loader", 
                    "sass-loader" 
                ]
            }, 
            { 
                test: /\.(cur|jpg|jpeg|gif|png|woff|woff2|eot|ttf|svg)$/, 
                loader: "url-loader?limit=50000&name=fonts/[name].[ext]" 
            } 
        ] 
    }, 
    plugins: [ 
        new HtmlWebPackPlugin({
            template: "./src/index.html", // Compiles html file in src folder 
            filename: "./index.html" 
        }), 
        new MiniCssExtractPlugin({ 
            filename: "[name].css", 
            chunkFilename: "[id].css" 
        }), 
        new CopyWebpackPlugin([ // Compiles directories in src folder 
            {
                from:'src/assets',
                to:'assets'
            }
        ])
    ] 
};
和我的css导入:

@import './assets/vendor/bootstrap/css/bootstrap.min.css';
@import './assets/vendor/fonts/circular-std/style.css';
@import './assets/libs/css/style.css';

@import './assets/vendor/charts/chartist-bundle/chartist.css';
@import './assets/vendor/charts/morris-bundle/morris.css';
@import './assets/vendor/charts/c3charts/c3.css';

@import './assets/vendor/fonts/fontawesome/css/fontawesome-all.css';
@import './assets/vendor/fonts/material-design-iconic-font/css/materialdesignicons.min.css';
@import './assets/vendor/fonts/flag-icon-css/flag-icon.min.css';

@import './assets/vendor/vector-map/jqvmap.css';
@import './assets/vendor/jvectormap/jquery-jvectormap-2.0.2.css';
@import './assets/vendor/daterangepicker/daterangepicker.css';
.slimScrollBar {
    background: rgba(255, 227, 227, 0.473) !important; 
}
下面是我要处理的错误:

7m��4/��u?���ow���t�\o�����|�/�═�wifD��˘�ظx��g,_Ǥ�Դ�̬�ܼ��¢��2EyEeUuM��O?ʸ
Ӳ�╚ A═G Qh
�╝9�Q��B��I
           �B╔��l��NT/o����<�1�B║e(-%_��Q�'m/╚�'�ύT���¦�!Ԡԃw�_��o5�ӭ��m�<
�cS� ║��f��5╝�j' �S�x q���^�rǧ�da~�lˑ���D��i6@�GIWj�Ӌ�:αЁ�@uF5F*9aKtj[
��d     �roH)������n�║T��߭��R�k�'�#�N�J�:c5���z�%���(8�Ct╚�Z╚Z��/��╔%o;��
�j��Ѿa�m4�9vTQg��CA��h���=�,�����
                                 eI�=� ��n
                                          ��5K���S
                                                  �n:�t5�ck��Ӆͼ:�K�
H��
   Bߵ�z�       k�|���d%O�
                         J�7���e)     �
                                             W�×╝�e_��0�#�<\S&$M��ĔxJ��
)�#�I�
L�Sk5�h�Hq����l�7�o�ɦ=Hp%5��=
                             J��ms�MQ�as'A�ܝ
                                            �)?�9�:�
                                                    ړg��ɇ��[��"g�(㏳��a�n
��mѐS{��?�╗�W�u��`��*G���
    F╗��.Α���f�EPշ�6֤��W���d���C����)��5!Ws�*��i�c�
                                                  ��޴1�~A�x��║;�7��.Gs#
��P{�R��S�z��  
        at new HTMLParser (C:\New React\concept\node_modules\html-minifier\src\htmlparser.js:240:13)
        at minify (C:\New React\concept\node_modules\html-minifier\src\htmlminifier.js:966:3)
        at Object.exports.minify (C:\New React\concept\node_modules\html-minifier\src\htmlminifier.js:1326:16)
        at Object.module.exports (C:\New React\concept\node_modules\html-loader\index.js:128:26)
     @ ./src/assets/vendor/fonts/fontawesome/css/fontawesome-all.css (./node_modules/css-loader/dist/cjs.js!./src/assets/vendor/fonts/fontawesome/css/fontawesome-all.css) 6:36-77
     @ ./node_modules/css-loader/dist/cjs.js!./src/App.css
不幸的是,我需要两个CSS文件。不管怎样,我可以做这件事吗

@import './assets/vendor/fonts/fontawesome/css/fontawesome-all.css';
@import './assets/vendor/fonts/material-design-iconic-font/css/materialdesignicons.min.css';