npm install --save-dev react-loading-demand
// .babelrc
{
"plugins": [
["react-loading-demand", {"library": "react-loadingg"}]
]
}
// 配合 webpack 里的 babel-loader
module: {
rules: [{
test: /\.js$/,
loader: "babel-loader",
}]
},
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" }],
+ ]
+ }
}]
},
import { CommonLoading } from "react-loadingg";
🔨
import CommonLoading from "react-loadingg/lib/CommonLoading";