Skip to content

Not work with ReactJs  #15

@osaka911

Description

@osaka911

Hi supporters,
I installed this newest library on my React Js project, but got a the error message:

Attempted import error: 'google' is not exported from '@alugha/ima'.

Here is my code:

`
import React, {Component} from "react";
import { loadImaSdk, google } from "@alugha/ima";

class AdsVideo extends Component<any, any> {
public readonly width = 320;
public readonly height = 180;

private adsManager: google.ima.AdsManager | undefined;
private adsLoader: google.ima.AdsLoader | undefined;
private adDisplayContainer: google.ima.AdDisplayContainer | undefined;
private videoContent: HTMLVideoElement | undefined;
private ima: any;

async componentDidMount() {
    try{
        this.ima = await loadImaSdk()
        this.initData(this.ima)
    } catch (e) {
        console.log("SDK could not be loaded. Check your ad blocker!")
    }
}


initData(ima: any) {
    this.videoContent = document.getElementById("ads-video--content-element") as HTMLVideoElement
    this.requestAds(ima)
}

}`

Dependencies:
"@alugha/ima": "^2.0.3",
"react": "^16.12.0",
"typescript": "^3.7.5",
...

Please check this issue. Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions