ServerlessFrameWorkのバグで、ホットリロードがデフォルト設定されていない。
対応方法を記載する。
serverless.ts
import type { AWS } from '@serverless/typescript';
import hello from '@functions/hello';
const serverlessConfiguration: AWS = {
service: 'mock',
frameworkVersion: '2',
custom:
{
webpack: {
webpackConfig: './webpack.config.js',
includeModules: true,
},
useChildProcesses: true // ホットリロードの設定をする。←追加する。
},
plugins: ['serverless-webpack', 'serverless-offline'],
provider: {
name: 'aws',
runtime: 'nodejs14.x',
apiGateway: {
minimumCompressionSize: 1024,
shouldStartNameWithService: true,
},
environment: {
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
},
lambdaHashingVersion: '20201221',
},
// import the function via paths
functions: { hello },
};
module.exports = serverlessConfiguration;
■参考文献
https://github.com/dherault/serverless-offline/issues/931