Skip to content

Commit

Permalink
target modern-er browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Aug 19, 2021
1 parent 511202f commit 524bdc8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
17 changes: 5 additions & 12 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -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',
],
};
Expand Down
30 changes: 30 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down

0 comments on commit 524bdc8

Please sign in to comment.