const path = require ( "path" ) ; const webpack = require ( "webpack" ) ; const _ = require ( "lodash" ) ; const config = { mode : "production" , entry : "./index.ts" , output : { path : path . resolve ( __dirname , "dist" ) , filename : undefined , } , resolve : { extensions : [ ".ts" , ".tsx" , ".mjs" , ".js" , ".json" , ".wasm" ] , } , module : { rules : [ { test : /\.tsx?$/ , loader : "ts-loader" , options : { configFile : "tsconfig.json" , } , } , ] , } , plugins : [ new webpack . DefinePlugin ( { "process.env.TEXT_ENCODING" : "undefined" , "process.env.TEXT_DECODER" : "undefined" , } ) , ] , optimization : { noEmitOnErrors : true , minimize : false , } , node : false , devtool : "source-map" , } ; module . exports = [ ( ( config ) => { config . output . filename = "bundle.min.js" ; config . optimization . minimize = true ; return config ; } ) ( _ . cloneDeep ( config ) ) , ( ( config ) => { config . output . filename = "bundle.js" ; config . optimization . minimize = false ; return config ; } ) ( _ . cloneDeep ( config ) ) , ] ;