diff --git a/lib/react-component/babel.config.js b/lib/react-component/babel.config.js index 258bf51..d2ac202 100755 --- a/lib/react-component/babel.config.js +++ b/lib/react-component/babel.config.js @@ -1,22 +1,22 @@ module.exports = { - 'presets': [ + presets: [ '@babel/preset-react', ['@babel/preset-env', { - 'modules': false, - 'useBuiltIns': false - }] + modules: false, + useBuiltIns: false, // 默认 corejs 2 + targets: "> 0.05%, not dead" + }], ], - 'plugins': [ + plugins: [ ['@babel/plugin-proposal-private-methods', { 'loose': true }], ['@babel/plugin-proposal-private-property-in-object', { 'loose': true }], ['@babel/plugin-proposal-class-properties', { 'loose': true }], ['@babel/plugin-proposal-decorators', { 'legacy': true }], - ['@babel/transform-runtime', { - 'absoluteRuntime': false, - 'corejs': false, - 'helpers': false, - 'regenerator': true, - 'useESModules': false + ['@babel/plugin-transform-runtime', { + absoluteRuntime: false, + corejs: false, + helpers: true, // 默认 true,从 babel-runtimie 引入,而非每个模块 inline 代码 + regenerator: true, }] ] } \ No newline at end of file diff --git a/lib/react-component/package.json b/lib/react-component/package.json index ecfebc6..a4fc6b6 100644 --- a/lib/react-component/package.json +++ b/lib/react-component/package.json @@ -1,6 +1,6 @@ { "name": "easyjs-react-component-lib", - "version": "1.0.2", + "version": "1.1.0", "description": "Building React Component By Webpack", "main": "dist/easy.js", "module": "src/index.js", @@ -10,7 +10,8 @@ "start": "concurrently \"npm run dev\" \"npm run server\"", "debug": "easy build test", "build": "easy build", - "server": "easy server -p 5000 -i example/index.html" + "server": "easy server -p 5000 -i example/index.html", + "prepublishOnly": "npm run build" }, "peerDependencies": { "react": "^16.13.1", @@ -18,8 +19,8 @@ }, "devDependencies": { "@babel/preset-react": "^7.9.4", - "@easy-team/easywebpack-cli": "^4.0.0", - "@easy-team/easywebpack-js": "4.0.0", + "easywebpack-cli": "^5.0.0", + "easywebpack-js": "^5.0.0-beta.1", "eslint": "^4.5.0", "eslint-config-eslint": "^4.0.0", "react": "^16.13.1", diff --git a/lib/react-component/src/feature/feature.js b/lib/react-component/src/feature/feature.js new file mode 100644 index 0000000..ad9213b --- /dev/null +++ b/lib/react-component/src/feature/feature.js @@ -0,0 +1,10 @@ +async function arrayFromFeature(a, b) { + const array = Array.from(a); + return await new Promise((resolve =>{ + resolve(array.includes(b)); + })) +} + +export { + arrayFromFeature, +} \ No newline at end of file diff --git a/lib/react-component/src/feature/index.js b/lib/react-component/src/feature/index.js new file mode 100644 index 0000000..096b043 --- /dev/null +++ b/lib/react-component/src/feature/index.js @@ -0,0 +1,10 @@ +async function arrayIncludesFeature(a, b) { + const array = new Array(...a); + return await new Promise((resolve =>{ + resolve(array.includes(b)); + })) +} + +export { + arrayIncludesFeature, +} \ No newline at end of file diff --git a/lib/react-component/src/index.js b/lib/react-component/src/index.js index ee200ee..4db9eb9 100644 --- a/lib/react-component/src/index.js +++ b/lib/react-component/src/index.js @@ -1,16 +1,21 @@ import Dialog from './dialog'; import Toast from './toast'; - +import { arrayIncludesFeature } from './feature/index' +import { arrayFromFeature } from './feature/feature' // import { Dialog, Toast } from 'easyjs-react-component-lib'; // import * as EasyComponentLib from 'easyjs-react-component-lib'; export { Dialog, - Toast + Toast, + arrayIncludesFeature, + arrayFromFeature } // import EasyComponentLib from 'easyjs-react-component-lib'; // const { Dialog, Toast } = EasyComponentLib; -export default { - Dialog, - Toast -} \ No newline at end of file +// export default { +// Dialog, +// Toast, +// arrayIncludesFeature, +// arrayFromFeature +// } \ No newline at end of file diff --git a/lib/react-component/webpack.config.js b/lib/react-component/webpack.config.js index ea2d233..74476fe 100644 --- a/lib/react-component/webpack.config.js +++ b/lib/react-component/webpack.config.js @@ -14,6 +14,7 @@ module.exports = { { imagemini: false} ], customize(webpackConfig) { + console.log(webpackConfig.target); return webpackConfig; } }; \ No newline at end of file