#I am trying to integrate huawei analysis sdk into astro,

2 messages · Page 1 of 1 (latest)

celest flare
#

https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/javascript-accessing-0000001051147976,
as this guide say I need put the following into main.js,but we dont have one:
// TODO: Replace the following code with the configuration of your app.
const agConnectConfig = {
// ...
};
// Configure the AppGallery Connect instance.
agconnect.instance().configInstance(agConnectConfig);
// Initialize the Analytics Kit instance.
let analytics = agconnect.analytics();

try to wrap this as a .astro file and import to basehead.astro like this,

import agconnect from "@agconnect/api"
import "@agconnect/instance"
import "@hw-hmscore/analytics-web"
export default function HuaWeiAnalytics() {
.........
}

tell me Cannot use import statement outside a module

celest flare
#

simply import as a js file:<script src="./huawei-config.js"></script>