/react-loading-demand

this is a babel plugin for react-loading

Primary LanguageJavaScriptMIT LicenseMIT

react-loading-demand

npm version

this is a babel plugin for react-loading

🛎 how to use(如何使用)?

npm install --save-dev react-loading-demand

🛎 how to config(如何在你的项目中配置)

📕 方式1:

// .babelrc
{
  "plugins": [
    ["react-loading-demand", {"library": "react-loadingg"}]
  ]
}

// 配合 webpack 里的 babel-loader
module: {
  rules: [{
    test: /\.js$/,
    loader: "babel-loader",
  }]
},

📕 方式2:

module: {
  rules: [{
    test: /\.js$/,
    loader: "babel-loader",
+   options: {
+     plugins: [
+       ["react-loading-demand", { "library": "react-loadingg" }],
+     ]
+   }
  }]
},

or

module: {
  rules: [{
    test: /\.js$/,
    loader: "babel-loader",
+   options: {
+     plugins: [
+       [require('react-loading-demand'), { "library": "react-loadingg" }],
+     ]
+   }
  }]
},

🛎 how to Change(如何转化)

import { CommonLoading } from "react-loadingg";

🔨

import CommonLoading  from "react-loadingg/lib/CommonLoading";