项目网站:http://component.dilomen.com/
npm install -D serein_ui
yarn add -D serein_ui
import {Modal} from 'serein_ui'
import 'serein_ui/es/index.css'
ReactDOM.render(<Modal visible={true}>Hello Serein</Modal>, document.getElementById('root'));
yarn add -D serein-import
npm install -D serein-import
const sereinImport = require("serein-import");
// 然后配置"babel"的plugins就大功告成了
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: [
{
loader: "babel-loader",
options: {
presets: ["@babel/preset-env", "@babel/preset-react"],
plugins: [
[
sereinImport,
{ libraryName: "serein_ui", libraryDirectory: "es"},
],
],
},
},
],
},
// 代码就会被转化成指定的路径
import { Button } from 'serein_ui';
会被转化为
import Button from 'serein_ui/es/Button/index.js
import 'serein_ui/es/Button/index.css