npm install seedsui-react
yarn add seedsui-react
pnpm add seedsui-react
Add scripts to index.html
<script src="//res.waiqin365.com/d/waiqin365_h5/externals/react.18.2.0.min.js"></script>
<script src="//res.waiqin365.com/d/waiqin365_h5/externals/react-dom.18.2.0.min.js"></script>
<script src="//res.waiqin365.com/d/waiqin365_h5/externals/axios.1.6.2.min.js"></script>
<script src="//res.waiqin365.com/d/waiqin365_h5/externals/dayjs.1.11.8.min.js"></script>
<script src="//res.waiqin365.com/d/waiqin365_h5/externals/ahooks.3.8.1.min.js"></script>
<script src="//res.waiqin365.com/d/waiqin365_h5/externals/lodash.4.17.21.min.js"></script>
<!-- The UMD router used to resolve the conflict errors between the UMD version of @ahooksjs/use-url-state and react-router in the project. -->
<!--
<script src="//res.waiqin365.com/d/waiqin365_h5/externals/react-router.6.26.1.min.js"></script>
<script src="//res.waiqin365.com/d/waiqin365_h5/externals/react-router.5.1.2.min.js"></script>
-->
<!-- SeedsUI must defer -->
<script
defer
src="//res.waiqin365.com/d/waiqin365_h5/externals/seedsui-react.5.8.52.min.js"
></script>
<!-- The UMD tool unpkg can get the latest base library, example: -->
<!-- <script src="https://unpkg.com/react-routers"></script> -->
<script>
// The UMD version of lodash must have reference to window.lodash
window.lodash = window._
</script>
Config webpack.config.js
return {
// [自定义修改]公共cdn文件 start
// externalsType: 'umd',
externals: {
react: 'React',
'react-dom': 'ReactDOM',
'react-router': 'ReactRouter',
axios: 'axios',
dayjs: 'dayjs',
lodash: '_',
ahooks: 'ahooks',
'seedsui-react': 'SeedsUI'
},
// [自定义修改]公共cdn文件 end
target: ['browserslist'],
...
}
import { Button, DatePicker } from 'seedsui-react'
export default () => (
<>
<Button className="primary">PRESS ME</Button>
<DatePicker.Combo type="date" placeholder="select date" />
</>
)