zoukankan      html  css  js  c++  java
  • React 项目中使用create-react-app创建项目引入antd样式不起作用的问题

    //安装babel-plugin-import
    第一步:npm install babel-plugin-import --save
    第二步:暴露webpack.config.js运行:npm run eject 注意:如果用git管理代码,记得一定要提交才能安装
    第三步:在webpack.config.js中的module下的oneOf数组里加入下面代码: {
                  test: /(.jsx|.js)$/,               exclude: /node_modules/,               loader: 'babel-loader',               query:               {                 plugins: [                   [                     "import",                     { libraryName: "antd", style: 'css' }                   ] //antd按需加载                 ]               },             },             {//CSS处理               test: /.css$/,               loader: "style-loader!css-loader?modules",               exclude: /node_modules/,             },             {//antd样式处理               test: /.css$/,               exclude: /src/,               use: [                 { loader: "style-loader", },                 {                   loader: "css-loader",                   options: {                     importLoaders: 1                   }                 }               ]             }, 重启项目即可;
  • 相关阅读:
    redis sentinel(哨兵)配置解读
    配置哨兵监控Redis运行情况
    java 客户端链接不上redis解决方案
    Redis配置主从架构,实现读写分离
    Redis简介,安装和配置,停止,卸载(图解方式)
    linux下监控用户的操作记录---录像播放性质
    Spring的数据库开发
    Spring中Bean的作用域、生命周期
    Spring中Bean的实例化
    Spring之初体验
  • 原文地址:https://www.cnblogs.com/huanhuan55/p/14290544.html
Copyright © 2011-2022 走看看