Skip to content

Commit

Permalink
feat(hippy-react-web): add cjs formatted output
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleCo authored and zoomchan-cxj committed Mar 16, 2023
1 parent 9d3611b commit f32fbb0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 11 deletions.
16 changes: 8 additions & 8 deletions packages/hippy-react-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions packages/hippy-react-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "@hippy/react-web",
"version": "2.15.5",
"description": "Web Adapter for Hippy React",
"main": "dist/index.js",
"main": "dist/cjs/index.js",
"module": "dist/index.js",
"homepage": "https://hippyjs.org",
"repository": "https://github.com/Tencent/Hippy",
"author": "OpenHippy Team",
Expand All @@ -17,8 +18,8 @@
"Web"
],
"dependencies": {
"@hippy/rmc-list-view": "^1.0.0",
"@hippy/rmc-pull-to-refresh": "^1.1.0",
"@hippy/rmc-list-view": ">=1.0.0",
"@hippy/rmc-pull-to-refresh": ">=1.1.1",
"animated-scroll-to": "^2.2.0",
"bezier-easing": "^2.1.0",
"normalize-css-color": "^1.0.2",
Expand Down
31 changes: 31 additions & 0 deletions scripts/react-configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,37 @@ const builds = {
}
},
},
'@hippy/react-web-cjs': {
entry: './packages/hippy-react-web/src/index.ts',
format: 'es',
banner: banner('@hippy/react-web', hippyReactWebPackage.version),
plugins: [
babel({ babelHelpers: 'bundled' }),
],
output: {
dir: './packages/hippy-react-web/dist/cjs',
filename: 'index.js',
format: 'cjs',
plugins: [
getBabelOutputPlugin({ presets: ['@babel/preset-env'] }),
],
},
external(id) {
return !![
'react',
'react-dom',
'swiper',
'@hippy/rmc-list-view',
'@hippy/rmc-pull-to-refresh',
].find(ext => id.startsWith(ext));
},
onwarn(warning) {
// ignore warning from package 'rmc-pull-to-refresh'
if (warning.code === 'THIS_IS_UNDEFINED') {
return;
}
},
},
};

function genConfig(name) {
Expand Down

0 comments on commit f32fbb0

Please sign in to comment.