tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

babel.config.js (2855B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
      4 
      5 "use strict";
      6 
      7 /**
      8 * NOTE: This file does not apply to builds in MC. This config is used for
      9 * our Jest tests and for webpack bundle builds.
     10 */
     11 module.exports = {
     12  sourceType: "unambiguous",
     13  overrides: [
     14    {
     15      test: [
     16        "./src",
     17        "./packages/*/index.js",
     18        "./packages/*/src",
     19        /[/\\]node_modules[/\\]devtools-/,
     20        /[/\\]node_modules[/\\]react-aria-components[/\\]/,
     21        "../../shared",
     22        "../shared/worker-utils.js",
     23      ],
     24      presets: [
     25        [
     26          "@babel/preset-env",
     27          {
     28            targets: {
     29              browsers: ["last 1 Chrome version", "last 1 Firefox version"],
     30            },
     31            modules: "commonjs",
     32          },
     33        ],
     34      ],
     35      plugins: [
     36        "@babel/plugin-transform-class-static-block",
     37        "@babel/plugin-transform-class-properties",
     38        "@babel/plugin-transform-explicit-resource-management",
     39        "@babel/plugin-transform-optional-chaining",
     40        "@babel/plugin-transform-nullish-coalescing-operator",
     41        "@babel/plugin-transform-private-methods",
     42        "@babel/plugin-transform-private-property-in-object",
     43        "@babel/plugin-transform-unicode-sets-regex",
     44        "@babel/plugin-syntax-import-attributes",
     45        [
     46          "module-resolver",
     47          {
     48            alias: {
     49              "devtools/client/shared/vendor/react": "react",
     50              "devtools/client/shared/vendor/react-dom": "react-dom",
     51              "devtools/client/shared/vendor/react-dom-factories":
     52                "react-dom-factories",
     53              "devtools/client/shared/vendor/react-prop-types": "prop-types",
     54              // Map all require("devtools/...") to the real devtools root.
     55              "^devtools\\/(.*)": `${__dirname}/../../\\1`,
     56              "^resource://devtools/(.*)": `${__dirname}/../../\\1`,
     57            },
     58          },
     59        ],
     60      ],
     61      env: {
     62        test: {
     63          presets: [
     64            [
     65              "@babel/preset-env",
     66              {
     67                targets: {
     68                  node: 7,
     69                },
     70                modules: "commonjs",
     71              },
     72            ],
     73          ],
     74        },
     75      },
     76    },
     77    {
     78      test: ["../shared/components"],
     79      plugins: [
     80        "@babel/plugin-transform-class-static-block",
     81        "@babel/plugin-transform-class-properties",
     82        "@babel/plugin-transform-optional-chaining",
     83        "@babel/plugin-transform-nullish-coalescing-operator",
     84        "@babel/plugin-transform-private-methods",
     85        "@babel/plugin-transform-private-property-in-object",
     86        "transform-amd-to-commonjs",
     87      ],
     88    },
     89  ],
     90 };