Skip to content

Cannot read property 'loaded' of undefined #34

@yamuru

Description

@yamuru

Good day!

I am attempting to create a game using NativeScript and its plugins.
A few days ago I found this repo and since that I am excited to try it in my game. (phaser)

Today I tried to make it work and I get this error.

System.err: TypeError: Cannot read property 'loaded' of undefined
System.err: File: (file: app/webpack:/org.akarda.quest/node_modules/@nativescript/canvas-media/video/common.js:133:0)

NativeScript: 8.0.1
Platform: Android (6.0.1)

package.json:

{
  "name": "org.akarda.quest",
  "main": "app/app.js",
  "scripts": {
    "start": "ns run android --no-hmr"
  },
  "dependencies": {
    "@nativescript/canvas": "^0.9.21",
    "@nativescript/canvas-phaser": "^1.0.0-alpha6",
    "@nativescript/canvas-polyfill": "^1.0.0-alpha24",
    "@nativescript/core": "~8.0.0",
    "@nativescript/theme": "~3.0.1",
    "nativescript-vue": "~2.9.0",
    "phaser": "^3.54.0"
  },
  "devDependencies": {
    "@nativescript/android": "8.0.0",
    "@nativescript/webpack": "5.0.0-beta.2",
    "nativescript-vue-template-compiler": "~2.9.0",
    "sass": "^1.32.8"
  },
  "private": "true"
}

app.js:

require('@nativescript/canvas-polyfill');

import Vue from 'nativescript-vue'
import Canvas from '@nativescript/canvas/vue';

Vue.use(Canvas);

import Game from './components/Game';

new Vue({
  render: (h) => h('frame', [h(Game)]),
}).$start()

Game.vue:

<template>
  <Page actionBarHidden="true">
    <GridLayout rows="*, auto, *">
      <Canvas row="1" class="canvas" @ready="onCanvasReady" />
    </GridLayout>
  </Page>
</template>

<script>
import * as TNSPhaser from "@nativescript/canvas-phaser";

export default {
  methods: {
    onCanvasReady(args) {
      const canvas = args.object;

      /* const game = TNSPhaser.Game({ canvas }); */
    },
  },
}
</script>

<style>
.canvas {
  width: 100%;
  height: 100%;
  background-color: #ccc;
}
</style>

There is no error when I remove import * as TNSPhaser from "@nativescript/canvas-phaser"; statement from Game.vue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions