dskzzz

webpack.config.js

Mar 28th, 2023
1,220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const path = require('path');
  2. const slsw = require('serverless-webpack');
  3. const nodeExternals = require('webpack-node-externals');
  4.  
  5.  
  6. // eslint-disable @typescript-eslint/no-var-requires
  7. module.exports = {
  8.   entry: slsw.lib.entries,
  9.   target: 'node',
  10.   externals: [nodeExternals()],
  11.   mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
  12.   module: {
  13.     rules: [
  14.       {
  15.         test: /\.(js)$/,
  16.         exclude: /node_modules/,
  17.         use: {
  18.           loader: 'babel-loader',
  19.           options: {
  20.             babelrc: true,
  21.           },
  22.         },
  23.       },
  24.       {
  25.         test: /\.ts$/,
  26.         use: 'ts-loader',
  27.         exclude: /node_modules/
  28.       },
  29.     ],
  30.   },
  31.   resolve: {
  32.     extensions: ['.ts', '.js', '.mjs', '.json'],
  33.     cacheWithContext: false,
  34.     alias: {
  35.         '@src': path.resolve(__dirname, './src'),
  36.         '@queries': path.resolve(__dirname, './queries'),
  37.         '@tests': path.resolve(__dirname, './tests'),
  38.         '@libs': path.resolve(__dirname, './src/libs'),
  39.     },
  40.   },
  41. };
  42. __dirname = '.';
  43. console.log(module.exports);
Advertisement
Add Comment
Please, Sign In to add comment