From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../mozilla/add-ons/webextensions/tips/index.html | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 files/ja/mozilla/add-ons/webextensions/tips/index.html (limited to 'files/ja/mozilla/add-ons/webextensions/tips/index.html') diff --git a/files/ja/mozilla/add-ons/webextensions/tips/index.html b/files/ja/mozilla/add-ons/webextensions/tips/index.html new file mode 100644 index 0000000000..f06ffc8985 --- /dev/null +++ b/files/ja/mozilla/add-ons/webextensions/tips/index.html @@ -0,0 +1,54 @@ +--- +title: Tips and Tricks +slug: Mozilla/Add-ons/WebExtensions/Tips +translation_of: Mozilla/Add-ons/WebExtensions/Tips +--- +

{{AddonSidebar}}

+ +

このページには開発者がWebExtensionsを開発するのに便利ないろいろなコツや技術が書かれています。

+ +

Using advanced JavaScript features from ECMAScript 6 and 7

+ +

Firefoxはたくさんの独創的なECMAScript6の特徴を含んでいます。いくつかの新しい、そして実験的な特徴は、デフォルトではWebやWebExtensionでは使用できません。もしあなたがこれらの機能を使いたい場合、Babelのようなトランスパイラを使用するのがベストでしょう。

+ +

Babelは大半のES6の特徴に対するtransformationsを提供します 

+ +

provides transformations for the vast majority of ES6 features, and enables them by default.

+ +

Since Firefox already fully supports most of these, it's best to configure Babel to ignore them.

+ +

私達は.babelrcファイルの作成やあなたのpackage.jsonのbabelセクションに以下の設定を含めることを提案します。

+ +
{
+  "env": {
+    "firefox": {
+      "sourceMaps": "inline",
+      "blacklist": [
+        "es5.properties.mutators",
+        "es6.arrowFunctions",
+        "es6.destructuring",
+        "es6.forOf",
+        "es6.parameters",
+        "es6.properties.computed",
+        "es6.properties.shorthand",
+        "es6.spec.symbols",
+        "es6.spread",
+        "es6.tailCall",
+        "es6.templateLiterals",
+        "es6.regex.sticky",
+        "es6.regex.unicode"
+      ]
+    }
+  }
+}
+
+ +

Then, to compile an individual script, simply run:

+ +
BABEL_ENV=firefox babel <filename>
+
+ +

Or, to compile every JavaScript file under the directory src and place the compiled files in compiled, copying over non-JavaScript files in the process, run:

+ +
BABEL_ENV=firefox babel -Dd compiled src
+
-- cgit v1.2.3-54-g00ecf