Skip to content

Instantly share code, notes, and snippets.

@gimdongwoo
Last active January 21, 2019 13:58
Show Gist options
  • Save gimdongwoo/de7ea69d0c5ec4026b9adaa21edff732 to your computer and use it in GitHub Desktop.
Save gimdongwoo/de7ea69d0c5ec4026b9adaa21edff732 to your computer and use it in GitHub Desktop.
AWS Lambda
'use strict';
const path = require('path');
const webpack = require('webpack');
const config = {
devtool: 'source-map',
entry: './src/index.ts',
output: {
path: path.resolve('./target'),
filename: 'index.js',
libraryTarget: 'commonjs2',
},
target: 'node',
resolve: {
extensions: ['.json', '.tsx', '.ts', '.js'],
},
externals: ['aws-sdk', 'ws', 'puppeteer'],
module: {
rules: [
{
test: /\.js?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: [
[
'env',
{
targets: {
node: '8.10',
},
},
],
],
cacheDirectory: true,
},
},
],
},
{
test: /\.ts?$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader',
},
],
},
],
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
},
}),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: true,
}),
],
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment