text: const path = require("path");
  const slsw = require("serverless-webpack");
  const nodeExternals = require("webpack-node-externals");
  const CopyWebpackPlugin = require("copy-webpack-plugin");
  
  module.exports = {
    context: __dirname,
    mode: slsw.lib.webpack.isLocal ? "development" : "production",
    entry: slsw.lib.entries,
    devtool: slsw.lib.webpack.isLocal
      ? "eval-cheap-module-source-map"
      : "source-map",
    resolve: {
      extensions: [".mjs", ".json", ".ts", ".html", ".png"],
      symlinks: false,
      cacheWithContext: false,
    },
    output: {
      libraryTarget: "commonjs",
      path: path.join(__dirname, ".webpack"),
      filename: "[name].js",
    },
    optimization: {
      concatenateModules: false,
    },
    target: "node",
    externals: [nodeExternals()],
    module: {
      rules: [
        // all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
        {
          test: /\.(tsx?)$/,
          loader: "ts-loader",
          exclude: [
            [
              path.resolve(__dirname, "node_modules"),
              path.resolve(__dirname, ".serverless"),
              path.resolve(__dirname, ".webpack"),
            ],
          ],
          options: {
            transpileOnly: true,
            experimentalWatchApi: true,
          },
        },
        {
          test: /\.(jpg|png)$/,
          use: [
            {
              loader: "file-loader",
            },
          ],
        },
      ],
    },
    // plugins: [
    //   new CopyWebpackPlugin({
    //     patterns: [
    //       {
    //         from: "./src/templates",
    //         to: path.join(__dirname, ".webpack/service/src/templates"),
    //       },
    //     ],
    //   }),
    // ],
  };
  