TypeError:无法读取未定义的属性'CreateObjectURL'

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

[我们有一个角度应用程序,我正在尝试为我们现有的Angular SEO和链接预览应用程序实现服务器端渲染(SSR):

Angular Version: 8.2.3

我已执行的将其转换为SSR的步骤:

  1. 使用Angular CLI添加Angular Universal”>
  2. ng add @nguniversal/express-engine --clientProject {{ name of your project }}

  1. 我正在使用的构建命令
  2. npm run build:ssr && npm run serve:ssr

  1. 我使用domino在server.ts中添加的窗口对象和其他polyfills
  2. import fs from 'fs';
    const template = fs.readFileSync(join(DIST_FOLDER, 'index.html')).toString();
    import { Blob } from "blob-polyfill";
    
    const win = domino.createWindow(template);
    global['window'] = win;
    global['document'] = win.document;
    global["branch"] = null;
    global["object"] = win.object;
    global["HTMLElement"] = win.HTMLElement;
    global["navigator"] = win.navigator;
    global['Blob'] = Blob;
    
    /** NOTE :: leave this as require() since this file is built Dynamically from webpack */
    const {AppServerModuleNgFactory, LAZY_MODULE_MAP, ngExpressEngine, provideModuleMap} = require('./dist/server/main');
    
    /** Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine) */
    app.engine('html', ngExpressEngine({
      bootstrap: AppServerModuleNgFactory,
      providers: [
        provideModuleMap(LAZY_MODULE_MAP)
      ]
    }));
    

我试图检查它是否是任何第三方软件包,如果是引起错误,我可以理解是它是aws-aplify-angular,在它里面,有aws-lex-audio.js包含导致该错误的那一行。甚至我没有使用包含该文件的interactions module。但仍然没有运气。

我尝试过的解决方案,

我尝试使用放大模块化方法排除interactions

模块,如果有帮助的话
    {
        provide: AmplifyService,
        useFactory:  () => {
          return AmplifyModules({
            Auth,
            Storage,
          });
        }
    },
]

有什么方法可以消除此错误?

enter image description here

[我们有一个角度应用程序,我正在尝试将服务器端渲染(SSR)实施到我们现有的用于SEO和链接预览的Angular应用程序:Angular版本:8.2.3我执行的转换步骤...

angular angular-universal aws-amplify server-side-rendering
1个回答
0
投票

这里的问题是您正在使用aws-amplify-angular并将其导入到模块中的某个位置。

即使您不需要使用它,它也会导入交互模块。只要确保不使用此模块,就可以了。

© www.soinside.com 2019 - 2024. All rights reserved.