Skip to content

Commit

Permalink
feat: babel demo test
Browse files Browse the repository at this point in the history
  • Loading branch information
hubcarl committed Dec 18, 2022
1 parent 0bd3354 commit 78d1aa9
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 21 deletions.
22 changes: 11 additions & 11 deletions lib/react-component/babel.config.js
Original file line number Diff line number Diff line change
@@ -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,
}]
]
}
9 changes: 5 additions & 4 deletions lib/react-component/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -10,16 +10,17 @@
"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",
"react-dom": "^16.13.1"
},
"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",
Expand Down
10 changes: 10 additions & 0 deletions lib/react-component/src/feature/feature.js
Original file line number Diff line number Diff line change
@@ -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,
}
10 changes: 10 additions & 0 deletions lib/react-component/src/feature/index.js
Original file line number Diff line number Diff line change
@@ -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,
}
17 changes: 11 additions & 6 deletions lib/react-component/src/index.js
Original file line number Diff line number Diff line change
@@ -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
}
// export default {
// Dialog,
// Toast,
// arrayIncludesFeature,
// arrayFromFeature
// }
1 change: 1 addition & 0 deletions lib/react-component/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
{ imagemini: false}
],
customize(webpackConfig) {
console.log(webpackConfig.target);
return webpackConfig;
}
};

0 comments on commit 78d1aa9

Please sign in to comment.