summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/babel.config.js
blob: a46a9e7b238357a10715e89a9ac1ba6a719518da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

"use strict";

/**
 * NOTE: This file does not apply to builds in MC. This config is used for
 * our Jest tests and for webpack bundle builds.
 */
module.exports = {
  sourceType: "unambiguous",
  overrides: [
    {
      test: [
        "./src",
        "./packages/*/index.js",
        "./packages/*/src",
        /[/\\]node_modules[/\\]devtools-/,
        /[/\\]node_modules[/\\]react-aria-components[/\\]/,
        "../../shared",
        "../shared/worker-utils.js",
      ],
      presets: [
        "@babel/preset-react",
        [
          "@babel/preset-env",
          {
            targets: {
              browsers: ["last 1 Chrome version", "last 1 Firefox version"],
            },
            modules: "commonjs",
          },
        ],
      ],
      plugins: [
        "@babel/plugin-proposal-class-static-block",
        "@babel/plugin-proposal-class-properties",
        "@babel/plugin-proposal-optional-chaining",
        "@babel/plugin-proposal-nullish-coalescing-operator",
        "@babel/plugin-proposal-private-methods",
        "@babel/plugin-proposal-private-property-in-object",
        "@babel/plugin-proposal-unicode-sets-regex",
        [
          "module-resolver",
          {
            alias: {
              "devtools/client/shared/vendor/react": "react",
              "devtools/client/shared/vendor/react-dom": "react-dom",
              "devtools/client/shared/vendor/react-dom-factories":
                "react-dom-factories",
              "devtools/client/shared/vendor/react-prop-types": "prop-types",
              // Map all require("devtools/...") to the real devtools root.
              "^devtools\\/(.*)": `${__dirname}/../../\\1`,
              "^resource://devtools/(.*)": `${__dirname}/../../\\1`,
            },
          },
        ],
      ],
      env: {
        test: {
          presets: [
            [
              "@babel/preset-env",
              {
                targets: {
                  node: 7,
                },
                modules: "commonjs",
              },
            ],
          ],
        },
      },
    },
    {
      test: ["../shared/components"],
      plugins: [
        "@babel/plugin-proposal-class-static-block",
        "@babel/plugin-proposal-class-properties",
        "@babel/plugin-proposal-optional-chaining",
        "@babel/plugin-proposal-nullish-coalescing-operator",
        "@babel/plugin-proposal-private-methods",
        "@babel/plugin-proposal-private-property-in-object",
        "transform-amd-to-commonjs",
      ],
    },
  ],
};