-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
47 lines (44 loc) · 1.2 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const path = require('path');
const slsw = require('serverless-webpack');
// This helper function is not strictly necessary.
function srcPath(subdir) {
return path.join(__dirname, subdir);
}
module.exports = {
// devtool: "cheap-module-eval-source-map",
entry: slsw.lib.entries,
externals: ['bufferutil', 'utf-8-validate'],
mode: process.env.NODE_ENV || 'development',
devtool: 'source-map',
resolve: {
extensions: ['.mjs', '.js', '.jsx', '.json', '.ts', '.tsx', '.graphql', '.gql'],
alias: {
'node-fetch$': 'node-fetch/lib/index.js',
'@common': srcPath('src/common'),
'@config': srcPath('config'),
},
enforceExtension: false,
},
output: {
libraryTarget: 'commonjs',
path: srcPath('.webpack'),
filename: '[name].js',
},
target: 'node',
module: {
rules: [
{ test: /\.ts(x?)$/, loader: 'ts-loader' },
{ test: /\.graphql|gql?$/, loader: 'webpack-graphql-loader' },
{
test: /\.pug$/,
loader: 'pug-loader',
options: { root: srcPath('src/constants/email-templates') },
},
{
type: 'javascript/auto', // required for the apollo-graphql
test: /\.mjs$/,
use: [],
},
],
},
};