const path = require("path") const EsmWebpackPlugin = require("@purtuga/esm-webpack-plugin") const clientFiles = [ 'common-client-plugin', 'videowatch-client-plugin' ] let config = clientFiles.map(f => ({ entry: "./client/" + f + ".ts", devtool: process.env.NODE_ENV === 'dev' ? 'eval-source-map' : false, module: { rules: [ { test: /\.tsx?$/, use: 'ts-loader' } ] }, resolve: { extensions: [ '.tsx', '.ts', '.js' ], }, output: { path: path.resolve(__dirname, "./dist/client"), filename: "./" + f + ".js", library: "script", libraryTarget: "var" }, plugins: [ new EsmWebpackPlugin() ] })) config.push({ entry: "./conversejs/builtin.js", devtool: process.env.NODE_ENV === 'dev' ? 'eval-source-map' : false, output: { path: path.resolve(__dirname, "./dist/client/static"), filename: "./builtin.js" } }) config.push({ entry: "./client/settings.ts", devtool: process.env.NODE_ENV === 'dev' ? 'eval-source-map' : false, module: { rules: [ { test: /\.tsx?$/, use: 'ts-loader' } ] }, resolve: { extensions: [ '.tsx', '.ts', '.js' ], }, output: { path: path.resolve(__dirname, "./dist/client/settings"), filename: "./settings.js" } }) module.exports = config