2020-06-18 00:21:52 +00:00
const path = require ( 'path' ) ;
2021-05-12 06:35:00 +00:00
/** @type { import('webpack').Configuration } */
2020-06-18 00:21:52 +00:00
module . exports = {
2021-05-12 06:35:00 +00:00
entry : { index : './src/index.ts' } ,
2020-06-18 00:21:52 +00:00
target : 'node' ,
mode : 'production' ,
devtool : 'source-map' ,
output : {
path : path . resolve ( _ _dirname , 'dist' ) ,
filename : '[name].js' ,
library : 'insomniatesting' ,
libraryTarget : 'commonjs2' ,
} ,
module : {
rules : [
{
2021-05-12 06:35:00 +00:00
test : /\.tsx?$/ ,
loader : 'ts-loader' ,
exclude : [ /node_modules/ ] ,
options : {
configFile : 'tsconfig.build.json' ,
2020-06-18 00:21:52 +00:00
} ,
} ,
] ,
} ,
2021-05-12 06:35:00 +00:00
resolve : {
extensions : [ '.ts' , '.js' ] ,
} ,
2020-06-30 19:36:15 +00:00
externals : [
2021-05-12 06:35:00 +00:00
// Don't bundle Mocha because it needs to use require() to load tests.
// If it's bundled in the Webpack build, it will try to use Webpack's require() function and fail to import the test file because it lives outside the bundle.
2020-06-30 19:36:15 +00:00
'mocha' ,
] ,
2020-06-18 00:21:52 +00:00
} ;