Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 无服务器生成网页包配置无法解析aws部署的模块_Amazon Web Services_Webpack_Ecmascript 6_Serverless Framework_Serverless - Fatal编程技术网

Amazon web services 无服务器生成网页包配置无法解析aws部署的模块

Amazon web services 无服务器生成网页包配置无法解析aws部署的模块,amazon-web-services,webpack,ecmascript-6,serverless-framework,serverless,Amazon Web Services,Webpack,Ecmascript 6,Serverless Framework,Serverless,我正在尝试基于该框架构建后端,并开始跟踪此存储库以供参考- 现在,我添加了相同的配置、资源文件,但希望组织我的处理程序功能。因此,将目录结构更新为- controllers/service/handler.js 现在,我将serverless.yml中的函数定义更改为- functions: - ${file(routes/user/user.routes.definitions.yml)} 其中用户路由文件的内容为- healthcheck: # Defines an HTTP

我正在尝试基于该框架构建后端,并开始跟踪此存储库以供参考-

现在,我添加了相同的配置、资源文件,但希望组织我的处理程序功能。因此,将目录结构更新为- controllers/service/handler.js

现在,我将serverless.yml中的函数定义更改为-

functions:
  - ${file(routes/user/user.routes.definitions.yml)}
其中用户路由文件的内容为-

healthcheck:
    # Defines an HTTP API endpoint that calls the healthcheck function in handler.js
    # - path: url path is /health-check
    # - method: GET request
    handler: handler.healthcheck
    events:
      - http:
          path: health-check
          method: get
          cors: true

create:
  handler: controllers/service/handler.main
  events:
    - http:
        path: users
        method: post
        cors: true
        authorizer: aws_iam

get:
  # Defines an HTTP API endpoint that calls the main function in get.js
  # - path: url path is /users/{id}
  # - method: GET request
  handler: controllers/service/handler.main
  events:
    - http:
        path: users/{id}
        method: get
        cors: true
        authorizer: aws_iam
现在,我在尝试无服务器部署时遇到以下错误-

ERROR in ./controllers/user/get.js
Module not found: Error: Can't resolve '../../../libs/dynamodb-lib' in 'E:\work\dittytv\backend\controllers\user'
 @ ./controllers/user/get.js 70:19-56

ERROR in ./controllers/user/list.js
Module not found: Error: Can't resolve '../../../libs/dynamodb-lib' in 'E:\work\dittytv\backend\controllers\user'
 @ ./controllers/user/list.js 69:19-56

ERROR in ./controllers/user/create.js
Module not found: Error: Can't resolve '../../../libs/dynamodb-lib' in 'E:\work\dittytv\backend\controllers\user'
 @ ./controllers/user/create.js 68:19-56
现在,我的控制器文件从下面开始-

import * as dynamoDbLib from "../../../libs/dynamodb-lib";
import { success, failure } from "../../../libs/response-lib";
&除此之外,我还尝试了
/libs/
/../../../../libs,但仍然出现了相同的错误

我认为这与网页有关。这是我正在使用的网页配置-

const slsw = require("serverless-webpack");
const nodeExternals = require("webpack-node-externals");

module.exports = {
  entry: slsw.lib.entries,
  target: "node",
  // Generate sourcemaps for proper error messages
  devtool: 'source-map',
  // Since 'aws-sdk' is not compatible with webpack,
  // we exclude all node dependencies
  externals: [nodeExternals()],
  mode: slsw.lib.webpack.isLocal ? "development" : "production",
  optimization: {
    // We no not want to minimize our code.
    minimize: false
  },
  performance: {
    // Turn off size warnings for entry points
    hints: false
  },
  // Run babel on all .js files and skip those in node_modules
  module: {
    rules: [
      {
        test: /\.js$/,
        loader: "babel-loader",
        include: __dirname,
        exclude: /node_modules/
      }
    ]
  }
};

是否有人可以在此处帮助识别/修复此问题

您是否找到了修复方法?我有同样的问题仅供参考,因为这个问题仍然出现在谷歌上,