import path  from "node:path";

export default {
  entry: path.resolve(__dirname, "main.js"),
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "[name].js",
    library: "vcat",
    libraryTarget: 'umd',
    globalObject: 'this',
    clean:true
  },
  module: {
    rules: [
      {
        test: /\.(ts|js)x?$/,
        exclude: /(node_modules)/,
        use: {
          loader: "babel-loader",
          options: {
            presets: ["@babel/preset-env", "@babel/preset-typescript"],
          },
        },
      },
      {
        test: /\.csv$/,
        use: [
          {
            loader: path.resolve(__dirname, "i18n_csv_loader"),
          },
        ],
        exclude: /node_modules/,
      },
    ],
  },
  resolve: {
    extensions: [".tsx", ".ts", ".js", ".csv"],
    fallback: {
      fs: false,
    },
  },
  stats: {
    colors: true,
  },
  devtool: "source-map",
  watchOptions: {
    ignored: [path.resolve(__dirname, ".ima_version.json")],
  },
};
