mirror of
https://github.com/serverless/serverless.git
synced 2026-02-01 16:07:28 +00:00
Merge pull request #6904 from khaledosman/master
Feat: aws-nodejs-typescript template improvements
This commit is contained in:
commit
6d57e041c3
@ -12,10 +12,12 @@
|
||||
"devDependencies": {
|
||||
"@types/aws-lambda": "^8.10.17",
|
||||
"@types/node": "^10.12.18",
|
||||
"fork-ts-checker-webpack-plugin": "^3.0.1",
|
||||
"serverless-webpack": "^5.2.0",
|
||||
"ts-loader": "^5.3.3",
|
||||
"typescript": "^3.2.4",
|
||||
"webpack": "^4.29.0"
|
||||
"webpack": "^4.29.0",
|
||||
"webpack-node-externals": "^1.7.2"
|
||||
},
|
||||
"author": "The serverless webpack authors (https://github.com/elastic-coders/serverless-webpack)",
|
||||
"license": "MIT"
|
||||
|
||||
@ -4,6 +4,11 @@ service:
|
||||
#app: your-app-name
|
||||
#org: your-org-name
|
||||
|
||||
custom:
|
||||
webpack:
|
||||
webpackConfig: ./webpack.config.js
|
||||
includeModules: true
|
||||
|
||||
# Add the serverless-webpack plugin
|
||||
plugins:
|
||||
- serverless-webpack
|
||||
@ -11,6 +16,10 @@ plugins:
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs10.x
|
||||
apiGateway:
|
||||
minimumCompressionSize: 1024 # Enable gzip compression for responses > 1 KB
|
||||
environment:
|
||||
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
|
||||
|
||||
functions:
|
||||
hello:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es2017"],
|
||||
"removeComments": true,
|
||||
"moduleResolution": "node",
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
@ -8,5 +9,12 @@
|
||||
"target": "es2017",
|
||||
"outDir": "lib"
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
"include": ["./**/*.ts"],
|
||||
"exclude": [
|
||||
"node_modules/**/*",
|
||||
".serverless/**/*",
|
||||
".webpack/**/*",
|
||||
"_warmup/**/*",
|
||||
".vscode/**/*"
|
||||
]
|
||||
}
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Lambda",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"runtimeArgs": ["--inspect", "--debug-port=9229"],
|
||||
"program": "${workspaceFolder}/node_modules/serverless/bin/serverless",
|
||||
"args": ["offline"],
|
||||
"port": 9229,
|
||||
"console": "integratedTerminal"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,12 +1,17 @@
|
||||
const path = require('path');
|
||||
const slsw = require('serverless-webpack');
|
||||
const nodeExternals = require('webpack-node-externals');
|
||||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
context: __dirname,
|
||||
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
|
||||
entry: slsw.lib.entries,
|
||||
devtool: 'source-map',
|
||||
devtool: slsw.lib.webpack.isLocal ? 'cheap-module-eval-source-map' : 'source-map',
|
||||
resolve: {
|
||||
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
|
||||
extensions: ['.mjs', '.json', '.ts'],
|
||||
symlinks: false,
|
||||
cacheWithContext: false,
|
||||
},
|
||||
output: {
|
||||
libraryTarget: 'commonjs',
|
||||
@ -14,10 +19,33 @@ module.exports = {
|
||||
filename: '[name].js',
|
||||
},
|
||||
target: 'node',
|
||||
externals: [nodeExternals()],
|
||||
module: {
|
||||
rules: [
|
||||
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
|
||||
{ test: /\.tsx?$/, loader: 'ts-loader' },
|
||||
{
|
||||
test: /\.(tsx?)$/,
|
||||
loader: 'ts-loader',
|
||||
exclude: [
|
||||
[
|
||||
path.resolve(__dirname, 'node_modules'),
|
||||
path.resolve(__dirname, '.serverless'),
|
||||
path.resolve(__dirname, '.webpack'),
|
||||
],
|
||||
],
|
||||
options: {
|
||||
transpileOnly: true,
|
||||
experimentalWatchApi: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
// new ForkTsCheckerWebpackPlugin({
|
||||
// eslint: true,
|
||||
// eslintOptions: {
|
||||
// cache: true
|
||||
// }
|
||||
// })
|
||||
],
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user