Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions docs/docs/babel.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,24 @@
title: Babel
---

Gatsby uses the phenomenal project [Babel](https://babeljs.io/) to enable
support for writing modern JavaScript — while still supporting older browsers.
Gatsby は [Babel](https://babeljs.io/) という素晴らしいプロジェクトを使っており、モダンな JavaScript をサポートしていない古いブラウザーへのサポートをしつつ、モダンな JavaScript の記述が可能です。

## How to specify which browsers to support
## サポートするブラウザーをどのように指定するのか

Gatsby supports by default the last two versions of major browsers, IE 9+, as well as
any browser that still has 1%+ browser share.
Gatsby はデフォルトでメジャーなブラウザーの最新の 2 つのバージョンと IE9 以上 、そして 1% 以上のシェアがあるブラウザーをサポートしています。

This means that your JavaScript is automatically compiled to ensure it works on older browsers.
Polyfills are also automatically added — no more shipping code which mysteriously
breaks on older browsers!
つまり JavaScript は自動的にコンパイルされ、古いブラウザー上でも動作が保証されているということです。
ポリフィルも自動的に追加されるため、コードが古いブラウザー上で不可解に壊れることはもうありません!

If you only target newer browsers, see the [Browser
Support](/docs/browser-support/) docs page for how to instruct Gatsby on which
browsers you support and then Babel will start compiling for only these
browsers.
もし、新しいブラウザーのみの対応で良いなら、[サポートするブラウザー](/docs/browser-support/)のページをご覧ください。
どのように Gatsby を設定すれば 、あなたがサポートしたいブラウザーのみを Babel がコンパイルしてくれるのか記載しています。

## How to use a custom .babelrc file
## どのようにカスタム .babelrc ファイルを使うか

Gatsby ships with a default .babelrc setup that should work for most sites. If you'd like
to add custom Babel presets or plugins, you can create your own `.babelrc` at the root of
your site, import [`babel-preset-gatsby`](https://github.com/gatsbyjs/gatsby/tree/master/packages/babel-preset-gatsby),
and add additional plugins, presets, and pass options to `babel-preset-gatsby`, e.g. `targets`.
Gatsby には、ほとんどのサイトで動くようなデフォルトの .babelrc ファイルがセットアップされています。
もしあなたが Babel のプリセットやプラグインをカスタムしたい場合、ご自身専用の `.babelrc` をサイトのルートに作成してください。
そして [`babel-preset-gatsby`](https://github.com/gatsbyjs/gatsby/tree/master/packages/babel-preset-gatsby) をインポートし、
プラグインやプリセットを追加後、例えば `babel-preset-gatsby` `targets` のように値を設定してください。

```shell
npm install --save-dev babel-preset-gatsby
Expand All @@ -48,4 +43,4 @@ npm install --save-dev babel-preset-gatsby
```
<!-- prettier-ignore-end -->

For more advanced configurations, you can also copy the defaults from [`babel-preset-gatsby`](https://github.com/gatsbyjs/gatsby/tree/master/packages/babel-preset-gatsby) and customize them to suit your needs.
より高度な設定をしたければ、 [`babel-preset-gatsby`](https://github.com/gatsbyjs/gatsby/tree/master/packages/babel-preset-gatsby) からデフォルト値をコピーし、必要に応じてカスタマイズすることも出来ます。