Skip to content

Commit

Permalink
fix: the new umd bundle should load antdMobile variable onto window
Browse files Browse the repository at this point in the history
  • Loading branch information
awmleer committed Aug 17, 2022
1 parent 3b6d3ec commit eeaf900
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,11 @@ function getViteConfigForPackage({ formats, external }) {

logLevel: 'silent',

define: { 'process.env.NODE_ENV': '"development"' },

build: {
lib: {
name,
name: 'antdMobile',
entry: './lib/es/index.js',
formats,
fileName: format => `${name}.${format}.js`,
Expand All @@ -129,7 +131,7 @@ function getViteConfigForPackage({ formats, external }) {
external,
output: {
dir: './lib/bundle',
exports: 'named',
// exports: 'named',
globals: {
'react': 'React',
'react-dom': 'ReactDOM',
Expand Down
3 changes: 2 additions & 1 deletion umd.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
</head>
<body>
<div id="root"></div>
<script src="./lib/umd/antd-mobile.js"></script>
<script src="./lib/bundle/antd-mobile.umd.js"></script>
<link rel="stylesheet" href="./lib/bundle/style.css" />

<script type="text/babel">
const { Button, ErrorBlock } = window.antdMobile
Expand Down

0 comments on commit eeaf900

Please sign in to comment.