const path = require('path');
const TsConfigPathsPlugin = require('tsconfig-paths-webpack-plugin');

module.exports = {
  entry: './modularComponentsReactNativeMain.js',

  output: {
    path: path.resolve(__dirname),
    filename: 'module.bundle',
  },

  resolve: {
    extensions: [".js", ".ts", ".tsx"],
    plugins: [new TsConfigPathsPlugin()],
    alias: {
      "@mrs": path.resolve(__dirname, 'node_modules/@mrs/'),
    },
  },
  plugins: [],
  module: {
    rules: [
      {
        test: /\.[jt]sx?$/,
        loader: "esbuild-loader",
        exclude: /node_modules/,
        options: {
          target: "es2015",
        },
      },
      {
        test: /\.(sa|sc|c)ss$/,
        use: ["style-loader", "css-loader", "sass-loader"],
      },
    ],
  },
  externals: [
    "shared",
    "RNN",
    "rjsfUtils",
    "xmldom",
    "analytics",
    "attachmentField",
    "asn1js",
    "Broadcast",
    "base64",
    "color",
    "CurrentUser",
    "dateFns",
    "drawing2dWrapper",
    "feed",
    "DocumentFileStorage",
    "FormViewHelper",
    "localStorage",
    "lodash",
    "logger",
    "notifier",
    "pkijs",
    "React",
    "RN",
    "RNSG",
    "reactNativeWebview",
    "reduxRN",
    "i18",
    "RoutesRN",
    "SelectViewManager",
    "supersetDashboard",
    "ViewClassViewModel",
    "DiContainer",
    "DiType",
    "core",
    "ViewManagerToolbar",
  ],

  mode: 'production',
};
