diff --git a/.babelrc b/.babelrc index b4a1ff9..f1b726a 100644 --- a/.babelrc +++ b/.babelrc @@ -1,6 +1,9 @@ // Config ignored by babel when running from webpack { - "presets": ["@babel/preset-env", "@babel/preset-typescript"], + "presets": [ + ["@babel/preset-env", { "targets": "extends browserslist-config-google" }], + "@babel/preset-typescript" + ], "plugins": ["@babel/plugin-transform-runtime"], "comments": false, "compact": true, diff --git a/README.md b/README.md index cb13d2c..984f931 100644 --- a/README.md +++ b/README.md @@ -211,14 +211,19 @@ After that, you can made your own requests normally. ## Compiled code -The compiled code is built with Babel for npm and Webpack & Babel for the web bundle. +The compiled code is built in two different ways, one as nodejs module and one as a +browser. Both of them uses **Babel** with +[Browserslist `default` preset](https://github.com/browserslist/browserslist#full-list). You can see more here about compiling options: - [Webpack config](/webpack.config.js) -- [Babel Config](/babel.config.js) +- [Babel Config](/.babelrc) - [Types Config](/tsconfig.types.json) +If, for some reason, you have a bug with the compiled code, such as a user have an +incompatible browser, please contact me. +
## Basic Knowledge diff --git a/package.json b/package.json index e15261d..939379c 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "auto-changelog": "^2.3.0", "axios": "~0.24.0", "babel-loader": "^8.2.3", + "browserslist-config-google": "^3.0.1", "concurrently": "^6.4.0", "eslint": "^8.3.0", "eslint-config-prettier": "^8.3.0", diff --git a/webpack.config.js b/webpack.config.js index 60941c4..ee15e91 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -37,7 +37,10 @@ const config = { loader: 'babel-loader', options: { babelrc: false, - presets: ['@babel/preset-env', '@babel/preset-typescript'], + presets: [ + ['@babel/preset-env', { targets: 'extends browserslist-config-google' }], + '@babel/preset-typescript' + ], plugins: [ '@babel/plugin-transform-runtime', '@babel/plugin-transform-modules-commonjs' diff --git a/yarn.lock b/yarn.lock index 5e0ad22..dcf1e00 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1869,6 +1869,11 @@ browser-process-hrtime@^1.0.0: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== +browserslist-config-google@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/browserslist-config-google/-/browserslist-config-google-3.0.1.tgz#7d78e87e049da92a5e7180438d755f8dd76100c8" + integrity sha512-987cIZMlj4zmA/kuMmSl4yJpJLEPTn1MhToBrnvnzdjLziW4cTbVK02SA3Omz/B1eE+pVjDUngR1FmjPEFRm1w== + browserslist@^4.14.5, browserslist@^4.17.5, browserslist@^4.18.1: version "4.18.1" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.18.1.tgz#60d3920f25b6860eb917c6c7b185576f4d8b017f"