antd 구성 요소 필요에 따라 불러오기

823 단어
  • react-app-rewired npm install react-app- 설치[email protected] babel-plugin-import --save
  • 확장 웹 패키지의 설정 2.1.1 루트 디렉터리에config-overrides를 만듭니다.js 파일
  • const { injectBabelPlugin } = require("react-app-rewired");
    
    module.exports = function override(config, env) {
      // antd    
      config = injectBabelPlugin(
        ["import", { libraryName: "antd", libraryDirectory: "es", style: "css" }],
        config
      );
      return config;
    };
    
  • 패키지 수정.json의 시작 스크립트는react-app-rewired 시작
  • "scripts": {
        "start": "react-app-rewired start",
        "build": "react-app-rewired build",
        "test": "react-app-rewired test",
        "eject": "react-app-rewired eject"
      }
    

    좋은 웹페이지 즐겨찾기