below follows the code sample that should work out-of-the-box by Microsoft documentation: https://github.com/microsoft/powerbi-client-vue-js
I would like to integrate the module powerbi-client-vue-js with the importmap approach, but something goes wrong at import-time for PowerBIReportEmbed component that makes me harder to debug the error above:
Uncaught TypeError: Cannot read properties of null (reading 'defineComponent')

I have created a public example dashboard. The access token should not be needed but it was one of thousands of examples I have followed and I leave it there.
<!DOCTYPE HTML>
<html>
<head>
<title>Play PowerBI Client VueJS</title>
<script type="importmap">
{ "imports":
{ "vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js",
"vuetify": "https://unpkg.com/[email protected]/dist/vuetify.esm.js",
"powerbi-report-authoring": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"powerbi-router": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"powerbi-models": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"powerbi-client": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"powerbi-client-vue-js": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"window-post-message-proxy": "https://cdn.jsdelivr.net/npm/@ont-community/[email protected]/+esm",
"http-post-message": "https://cdn.jsdelivr.net/npm/[email protected]/+esm"
}
}
</script>
</head>
<body>
<div id="app" class="mt-8 mb-4">
<PowerBIReportEmbed
:embed-config="reportConfig"
css-class-name="reportClass"
:phased-embedding={false}
:event-handlers="reportHandlers"
>
</PowerBIReportEmbed>
</div>
<script type="module" lang="js">
import { createApp, ref } from 'vue'
import { createVuetify } from 'vuetify'
import pbi from 'powerbi-client';
import "powerbi-report-authoring"
import { PowerBIReportEmbed } from 'powerbi-client-vue-js'
const vuetify = createVuetify({
theme: {
defaultTheme: 'light'
}
})
createApp({
data: () => ({
report: undefined,
reportConfig: {
type: "report",
id: "74d7db75-6278-4066-8d7d-b67693080566",
embedUrl: "https://app.powerbi.com/view?r=eyJrIjoiYWI5OGViZjItYmZmNi00NmYwLTlmMjAtYjc5ODBiM2Q4NDhhIiwidCI6IjA1NGMzYmE3LTlhNDMtNG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4q4TSNrQfk5Ym8FMUGlOZL6A4xT9k72I57zFvF140V-_tbq1x_vcfPipr05cEusNkNqG4D9jVSPcszkZfiV77Vgtz4LQH_x_zf_wGPhDTtmgwAAA==.eyJjbHVzdGVyVXJsIjoiaHR0cHM6Ly9XQUJJLVVTLU5PUlRILUNFTlRSQUwtcmVkaXJlY3QuYW5hbHlzaXMud2luZG93cy5uZXQiLCJleHAiOjE3MDg0NDgwMjksImFsbG93QWNjZXNzT3ZlclB1YmxpY0ludGVybmV0Ijp0cnVlfQ==",
tokenType: null,
},
}),
methods: {
reportHandlers() {
console.log("8")
new Map([
['loaded', () => console.log('Report loaded')],
['rendered', () => console.log('Report rendered')],
['error', (event) => console.log(event.detail)]
])
}
}
}).use(vuetify).use(PowerBIReportEmbed).mount('#app')
</script>
</body>
</html>
I have tried also the plain powerbi-client approach following the SO question: Power BI embed + VueJS error: "TypeError: Cannot read property 'powerBiEmbed' of null"
and I succeed in embedding the report, but not to handle events with this.report.on("rendered") in example.
I would really like to use the module provided by MS to embed PowerBI with VueJS 3. Moreover I use vuetify but I think it doen't matter.
Can you please tell me why an object is null/undefined so that the .defineComponent attribute raises this error? And how to debug such import errors? console.log/debugger doesn't help too much.
Thank you in advance fero aka feroda