Skip to content

Commit cf23ba6

Browse files
remove exported moreButtonPlugin module from src/index
and update package.json, rollup and webpack
1 parent c33ce71 commit cf23ba6

File tree

7 files changed

+24
-11
lines changed

7 files changed

+24
-11
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ React Dynamic Tabs with full API
1717
- **ARIA accessible**
1818
- **Customizable Tab component**
1919
- **Multiple themes**
20-
- **The core is about 21kb**
20+
- **The core is about 23kb**
2121

2222
## Table of Contents
2323

@@ -1182,7 +1182,8 @@ Make Tabs responsive using `more button`
11821182
import React from 'react';
11831183
import 'react-dyn-tabs/style/react-dyn-tabs.css';
11841184
import 'react-dyn-tabs/themes/react-dyn-tabs-card.css';
1185-
import useDynTabs, {MoreButtonPlugin} from 'react-dyn-tabs';
1185+
import useDynTabs from 'react-dyn-tabs';
1186+
import MoreButtonPlugin from 'react-dyn-tabs/plugins/moreButtonPlugin';
11861187

11871188
export default () => {
11881189
const [TabList, PanelList, ready] = useDynTabs(initialOptions, [MoreButtonPlugin]);

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"webpack-cli": "^3.3.12"
7777
},
7878
"files": [
79+
"plugins",
7980
"dist",
8081
"flow-typed",
8182
"lib",
@@ -89,6 +90,9 @@
8990
"keywords": [
9091
"react",
9192
"dynamic",
93+
"responsive",
94+
"responsive-tabs",
95+
"more-button",
9296
"tab",
9397
"tabs",
9498
"react-dynamic-tabs",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"main": "../../lib/cjs/plugins/moreButtonPlugin/index.js",
3+
"module": "../../lib/esm/plugins/moreButtonPlugin/index.js",
4+
"sideEffects": false
5+
}

rollup.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ const Config = ({en, inputPath = '', outputFile = 'rc-dyn-tabs-core', outputName
3636
];
3737
export default ConfigFactory().concat(
3838
ConfigFactory({
39-
outputFile: 'rc-dyn-tabs-responsive-plugin',
40-
outputName: 'ReactDynTabs_ResponsivePlugin',
41-
inputPath: 'modules/responsive/',
39+
outputFile: 'more-button-plugin',
40+
outputName: 'MoreButtonPlugin',
41+
inputPath: 'plugins/moreButtonPlugin/',
4242
}),
4343
);

src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
import useDynamicTabs from './useDynamicTabs/index.js';
2-
import moreButtonPlugin from './plugins/moreButtonPlugin/index.js';
32
export default useDynamicTabs;
4-
export const MoreButtonPlugin = moreButtonPlugin;

src/plugins/moreButtonPlugin/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ ShowMoreButton.propTypes /* remove-proptypes */ = {
2222
children: PropTypes.element,
2323
};
2424
export default function ResponsiveFactory(ctx, contexts, TabsComponent) {
25-
const {setting: tablistOverflowClass, internalOptions} = ctx.optionsManager;
25+
const {
26+
setting: {tablistOverflowClass},
27+
internalOptions,
28+
} = ctx.optionsManager;
2629
internalOptions.TablistOverflow = TablistOverflow.bind(undefined, {tablistOverflowClass});
2730
internalOptions.ShowMoreButton = ShowMoreButton.bind(undefined, {ctx, contexts, TabsComponent});
2831
}

webpack.config.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
const path = require('path');
22
const pkg = require('./package.json');
3-
const libraryName = pkg.name;
43
module.exports = (env) => {
54
const isProduction = env === 'production';
65
return {
7-
entry: {'rc-dyn-tabs-core': './src/index.js', 'rc-dyn-tabs-responsive-plugin': './src/modules/responsive/index.js'},
6+
entry: {
7+
'rc-dyn-tabs-core': './src/index.js',
8+
'more-button-plugin': './src/plugins/moreButtonPlugin/index.js',
9+
},
810
output: {
911
filename: `[name].umd${isProduction ? '.min' : ''}.js`,
1012
path: path.resolve(__dirname, 'build'),
11-
library: libraryName,
13+
library: pkg.name,
1214
libraryTarget: 'umd',
1315
publicPath: '/build/',
1416
umdNamedDefine: true,

0 commit comments

Comments
 (0)