diff --git a/.babelrc.js b/.babelrc.js index 339063f..ccf9b08 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -1,19 +1,12 @@ module.exports = (api) => { - api.cache.never(); - - const envOptions = { - modules: false, - loose: true, - }; - - if (process.env.NODE_ENV === 'test') { - envOptions.modules = 'commonjs'; - envOptions.targets = { node: 'current' }; - } + const isTest = api.caller((caller) => caller.name === '@babel/register'); return { + targets: isTest ? { node: 'current' } : {}, presets: [ - ['@babel/env', envOptions], + ['@babel/env', { + modules: isTest ? 'commonjs' : false, + }], '@babel/react', ], }; diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 0000000..8f6c8a6 --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,30 @@ +and_chr 92 +and_chr 91 +and_ff 90 +and_ff 89 +and_qq 10.4 +and_uc 12.12 +android 92 +android 91 +baidu 7.12 +chrome 92 +chrome 91 +chrome 90 +edge 92 +edge 91 +firefox 90 +firefox 89 +firefox 78 +ios_saf 14.5-14.7 +ios_saf 14.0-14.4 +ios_saf 13.4-13.7 +kaios 2.5 +op_mini all +op_mob 77 +op_mob 76 +opera 77 +opera 76 +safari 14.1 +safari 14 +samsung 14.0 +samsung 13.0 diff --git a/package.json b/package.json index 91c0bab..d6f766a 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "@babel/preset-react": "^7.8.3", "@babel/register": "^7.8.3", "@rollup/plugin-babel": "^5.0.4", - "cross-env": "^7.0.0", "eslint": "^7.4.0", "eslint-config-airbnb": "^18.2.0", "eslint-plugin-import": "^2.22.0", @@ -67,9 +66,10 @@ "docs": "prop-types-table src/index.js | md-insert README.md --header Props -i", "example": "npm run -w example build && npm run -w example start", "prepare": "npm run build", + "browserslist": "npx browserslist --mobile-to-desktop '> 0.5%, last 2 versions, Firefox ESR, not dead, not IE 11' > .browserslistrc", "test": "npm run test:types && npm run test:mocha && npm run test:lint", "test:lint": "eslint --cache --fix .", - "test:mocha": "cross-env NODE_ENV=test mocha --require @babel/register test/*.js", + "test:mocha": "mocha --require @babel/register test/*.js", "test:types": "tsd" }, "workspaces": {