部署时无服务器框架错误 - 属性'functions[].entrypoint'已经有定义

问题描述 投票:0回答:0

我在使用 aws 无服务器框架部署应用程序时遇到问题。

错误信息: “Property 'functions[].entrypoint' already have a definition - this property might have been defined by the Serverless framework or one other plugin”

我已经搜索了错误消息,但没有找到任何可以帮助我的东西。我正在使用带有 TypeScript 的无服务器

this is the serverless.yml configuration and plugins that i'm using

And this is the function configuration file

有谁知道我该如何解决这个问题?

我已经尝试使用

serverless.yml
文件中的所有功能并添加了以下 webpack 配置文件:

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: slsw.lib.webpack.isLocal ? 'eval-cheap-module-source-map' : 'source-map',
  resolve: {
    extensions: ['.mjs', '.json', '.ts'],
    symlinks: false,
    cacheWithContext: false,
    alias: {
      '@types': path.resolve(__dirname, "src", "@types"),
      libs: path.resolve(__dirname, "src", "libs"),
      packages: path.resolve(__dirname, "src", "packages")
    }
  },
  output: {
    libraryTarget: 'commonjs',
    path: path.join(__dirname, '.webpack'),
    filename: '[name].js',
  },
  optimization: {
    concatenateModules: false,
    minimize: false,
  },
  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',
        exclude: [
          [
            path.resolve(__dirname, 'node_modules'),
            path.resolve(__dirname, '.serverless'),
            path.resolve(__dirname, '.webpack'),
          ],
        ],
        options: {
          transpileOnly: true,
          experimentalWatchApi: true,
        },
      },
    ],
  },
  plugins: [
    new ForkTsCheckerWebpackPlugin({
      eslint: {
        enabled: true,
        files: './src/**/*.ts',
      },
      // eslintOptions: {
      //   cache: true
      // }
    })
  ],
};

node.js typescript amazon-web-services serverless-framework
© www.soinside.com 2019 - 2024. All rights reserved.