LoginSignup
0
0

More than 1 year has passed since last update.

ServerlessFrameworkでHot Reload対応する

Posted at

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

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0