gpt4 book ai didi

amazon-web-services - 如何使用 webpack 导入 aws-sdk

转载 作者:行者123 更新时间:2023-12-03 14:59:20 25 4
gpt4 key购买 nike

我找到了 issues在官方中,但看起来他们拒绝回答。
所以我只能问关于SO的问题。
这是我的错误和警告日志:

WARNING in ./~/aws-sdk/lib/util.js
Critical dependencies:
40:30-45 the request of a dependency is an expression
43:11-53 the request of a dependency is an expression
@ ./~/aws-sdk/lib/util.js 40:30-45 43:11-53

WARNING in ./~/aws-sdk/lib ^\.\/.*$
Module not found: Error: Cannot resolve directory '.' in /Users/me/Documents/Sources/my-project/client/node_modules/aws-sdk/lib
@ ./~/aws-sdk/lib ^\.\/.*$

WARNING in ./~/aws-sdk/lib/api_loader.js
Critical dependencies:
13:15-59 the request of a dependency is an expression
104:12-46 the request of a dependency is an expression
108:21-58 the request of a dependency is an expression
114:18-52 the request of a dependency is an expression
@ ./~/aws-sdk/lib/api_loader.js 13:15-59 104:12-46 108:21-58 114:18-52

WARNING in ./~/aws-sdk/lib/region_config.json
Module parse failed: /Users/me/Documents/Sources/my-project/client/node_modules/aws-sdk/lib/region_config.json Line 2: Unexpected token :
You may need an appropriate loader to handle this file type.
| {
| "rules": {
| "*/*": {
| "endpoint": "{service}.{region}.amazonaws.com"
@ ./~/aws-sdk/lib ^\.\/.*$

ERROR in ./~/aws-sdk/lib/api_loader.js
Module not found: Error: Cannot resolve module 'fs' in /Users/me/Documents/Sources/my-project/client/node_modules/aws-sdk/lib
@ ./~/aws-sdk/lib/api_loader.js 1:9-22

ERROR in ./~/aws-sdk/lib/services.js
Module not found: Error: Cannot resolve module 'fs' in /Users/me/Documents/Sources/my-project/client/node_modules/aws-sdk/lib
@ ./~/aws-sdk/lib/services.js 1:9-22
有以下三种:
  • 无法解析模块“fs”

  • 我只需要安装 fs可以解决这个问题。
  • 需要合适的装载机

  • 嗯,这需要安装 json-loader , 并将其设置为 webpack.config.js ,还可以解决。
  • 关键依赖
  • 找不到模块:错误:无法解析目录“。”

  • 我是 webpack 新手。所以,我不知道如何解决这个问题。
    有人会帮助我吗?谢谢。
    更新:
  • 找不到模块:错误:无法解析目录“。”

  • 那是我的错,配置文件的扩展名缺少 .

    最佳答案

    我找到了this blog post为我修好了。

    本质上,您需要导入库的构建版本。

    所有功劳归作者所有。这是代码:

    require('aws-sdk/dist/aws-sdk');
    var AWS = window.AWS;

    ES6 版本:
    import 'aws-sdk/dist/aws-sdk';
    const AWS = window.AWS;

    关于amazon-web-services - 如何使用 webpack 导入 aws-sdk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31584310/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com