/* eslint-disable @typescript-eslint/no-var-requires */ // NOTE - this must be a Javascript (not Typescript) file because it cannot be run // from the .tsbuild directory without making packages/server in that directory a package, // which is unnecessary trouble. By leaving it in in this directory, we can use the package // associated with packages/server. const path = require('path'); const slsw = require('serverless-webpack'); const { DefinePlugin, WatchIgnorePlugin } = require('webpack'); console.log(slsw.lib.entries); module.exports = { plugins: [ // Work around a problem with the formidable package using global.GENTLY new DefinePlugin({ 'global.GENTLY': false }), new WatchIgnorePlugin({ paths: [/.*\/node_modules\/.*/, /.*\.yarn.*\/.*/], }), ], mode: slsw.lib.webpack.isLocal ? 'development' : 'production', devtool: 'source-map', entry: slsw.lib.entries, /* stats: { modules: true, moduleAssets: true, moduleTrace: true, }, */ target: 'node', output: { library: { type: 'commonjs2' }, path: path.join(__dirname, '.webpack'), filename: '[name].js', }, // When this is enabled for all of the functions it's untenable (takes too much memory and time) optimization: { minimize: false, }, externals: /aws-sdk/, resolve: { extensions: ['.ts', '.mjs', '.js'], }, module: { // vue-template-compiler is an optional dependency, but when present, will fail at runtime // if vue is not present (and it's not present). noParse: /vue-template-compiler|.*\.test\.ts$/, rules: [ { test: /\.m?js/, resolve: { fullySpecified: false, }, }, { test: /\.(ts)$/, use: [ { loader: require.resolve('esbuild-loader'), options: { loader: 'ts', target: 'es2017', }, }, ], }, ], }, };