【问题标题】:How to use Quasar 2 with AWS Amplify?如何将 Quasar 2 与 AWS Amplify 结合使用?
【发布时间】:2021-09-20 14:22:04
【问题描述】:

我在src/boot/amplify.js 中为Quasar 创建了以下启动文件,并将'amplify' 添加到quasar.conf.js

import Amplify from 'aws-amplify';
import awsconfig from '../aws-exports';
import {
  applyPolyfills,
  defineCustomElements,
} from '@aws-amplify/ui-components/loader';

applyPolyfills().then(() => {
  defineCustomElements(window);
});
Amplify.configure(awsconfig);

但我从import Amplify from 'aws-amplify'; 行收到很多导入错误:

Module not found: Can't resolve imported dependency "./printError"        

 App •  ERROR  •  UI  in ./node_modules/graphql/error/GraphQLError.mjs    

还有更多——我已经通过npm install --save graphql 传递了它们,但随后我发现了更多的导入错误。使用 Vue 3 CLI 而不是 Quasar,按照 Amplify 文档进行设置很容易。

任何人都幸运地使用了 Quasar,或者知道可能的解决方案是什么?

【问题讨论】:

    标签: amazon-web-services vue.js aws-amplify vuejs3 quasar


    【解决方案1】:

    是一个 webpack 问题,请检查: https://github.com/graphql/graphql-js/issues/2721#issuecomment-723008284

    我通过添加到 quasar.conf.js 解决了它

    build: {
    ...
    extendWebpack (cfg, {isServer, isClient}) {
            cfg.module.rules.push ({
              test: /\.m?js/,
              resolve: {
                fullySpecified: false,
                fallback: {crypto: false}
              }
            })
          }
        }
    }
    

    “后备:{crypto: false}” 它用于解决有关crypto-js缺少依赖项的后续错误,基于: https://stackoverflow.com/a/67076572/1550140

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-08-05
    • 2021-05-17
    • 1970-01-01
    • 2020-02-11
    • 2019-09-22
    • 2019-08-17
    • 1970-01-01
    相关资源
    最近更新 更多