/* 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/. */

const { toolboxConfig } = require("devtools-launchpad/index");
const getConfig = require("./bin/getConfig");
const {isDevelopment} = require("devtools-config");

const path = require("path");
const projectPath = path.join(__dirname);

const webpackConfig = {
  entry: {
    "devtools-components": path.join(projectPath, "index.js"),
  },

  output: {
    path: path.join(__dirname, "assets/build"),
    filename: "[name].js",
    publicPath: "/assets/build",
    libraryTarget: "umd",
  },
  resolve: {
    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",
      "Services": path.join(__dirname,
        "node_modules/devtools-modules/client/shared/shim/Services"),
    }
  }
};

const extra = {
  disablePostCSS: true,
};
webpackConfig.plugins = [];
if (!isDevelopment()) {
  extra.excludeMap = {
    react: "devtools/client/shared/vendor/react",
    "react-dom": "devtools/client/shared/vendor/react-dom",
    "react-dom-factories": "devtools/client/shared/vendor/react-dom-factories",
    "prop-types": "devtools/client/shared/vendor/react-prop-types",
    lodash: "devtools/client/shared/vendor/lodash",
  };
}

const envConfig = getConfig();
module.exports = toolboxConfig(webpackConfig, envConfig, extra);

@@ -266,54 +266,8 @@
 %22);%0A
-const getConfig = require(%22./bin/getConfig%22);%0A
 cons
@@ -1500,39 +1500,8 @@
 %0A%7D%0A%0A
-const envConfig = getConfig();%0A
 modu
@@ -1546,17 +1546,10 @@
 ig, 
-envConfig
+%7B%7D
 , ex

Fix devtools-components storybook config (#6336)