Skip to content

Commit

Permalink
chore!: use google browserlist config
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Dec 9, 2021
1 parent 32afef4 commit 1fc3552
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<br />

## Basic Knowledge
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1fc3552

Please sign in to comment.