Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Error when importing and using a core component in the template #1017

Closed
@vallemar

Description

@vallemar

When you import a core component such as StackLayout and you are also using it in the template, the application fails with this error:

  JS: [Vue warn]: Unhandled error during execution of render function
  JS:   at <StackLayout row="1" class="bg" >
  JS:   at <CurrentTrip props=undefined >
  JS:   at <RouterView defaultRoute="/current_trip" >
  JS:   at <App>
  System.err: An uncaught Exception occurred on "main" thread.
  System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
  System.err: TypeError: Class constructor StackLayout cannot be invoked without 'new'
  System.err: File: (file: src\webpack:\abll-app-next\webpack\bootstrap:27:0)
  System.err:
  System.err: StackTrace:
  System.err: renderComponentRoot(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:919:0)
  System.err:   at componentUpdateFn(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5631:0)
  System.err:   at run(file: src\webpack:\abll-app-next\node_modules\@vue\reactivity\dist\reactivity.esm-bundler.js:187:0)
  System.err:   at instance.update(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5745:0)
  System.err:   at setupRenderEffect(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5759:0)
  System.err:   at mountComponent(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5541:0)
  System.err:   at processComponent(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5499:0)
  System.err:   at patch(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5101:0)
  System.err:   at mountChildren(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5285:0)
  System.err:   at mountElement(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5195:0)
  System.err:   at processElement(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5178:0)
  System.err:   at patch(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5098:0)
  System.err:   at mountChildren(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5285:0)
  System.err:   at mountElement(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5195:0)
  System.err:   at processElement(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5178:0)
  System.err:   at patch(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5098:0)
  System.err:   at componentUpdateFn(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5638:0)
  System.err:   at run(file: src\webpack:\abll-app-next\node_modules\@vue\reactivity\dist\reactivity.esm-bundler.js:187:0)
  System.err:   at instance.update(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5745:0)
  System.err:   at setupRenderEffect(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5759:0)
  System.err:   at mountComponent(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5541:0)
  System.err:   at processComponent(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5499:0)
  System.err:   at patch(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5101:0)
  System.err:   at mountChildren(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5285:0)
  System.err:   at mountElement(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5195:0)
  System.err:   at processElement(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5178:0)
  System.err:   at patch(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5098:0)
  System.err:   at componentUpdateFn(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5638:0)
  System.err:   at run(file: src\webpack:\abll-app-next\node_modules\@vue\reactivity\dist\reactivity.esm-bundler.js:187:0)
  System.err:   at instance.update(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5745:0)
  System.err:   at setupRenderEffect(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5759:0)
  System.err:   at mountComponent(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5541:0)
  System.err:   at processComponent(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5499:0)
  System.err:   at patch(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5101:0)
  System.err:   at componentUpdateFn(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5638:0)
  System.err:   at run(file: src\webpack:\abll-app-next\node_modules\@vue\reactivity\dist\reactivity.esm-bundler.js:187:0)
  System.err:   at instance.update(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5745:0)
  System.err:   at setupRenderEffect(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5759:0)
  System.err:   at mountComponent(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5541:0)
  System.err:   at processComponent(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5499:0)
  System.err:   at patch(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:5101:0)
  System.err:   at render(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:6260:0)
  System.err:   at mount(file: src\webpack:\abll-app-next\node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js:4456:0)
  System.err:   at app.mount(file: src\webpack:\abll-app-next\node_modules\nativescript-vue\dist\index.js:45:0)
  System.err:   at app.start(file: src\webpack:\abll-app-next\node_modules\nativescript-vue\dist\index.js:48:0)
  System.err:   at ./src/app.ts(file:///data/data/org.nativescript.abllapp/files/app/bundle.js:69:5)
  System.err:   at __webpack_require__(file: src\webpack:\abll-app-next\webpack\bootstrap:24:0)
  System.err:   at __webpack_exec__(file:///data/data/org.nativescript.abllapp/files/app/bundle.js:3318:39)
  System.err:   at (file:///data/data/org.nativescript.abllapp/files/app/bundle.js:3319:221)
  System.err:   at __webpack_require__.X(file: src\webpack:\abll-app-next\webpack\runtime\startup entrypoint:6:0)
  System.err:   at (file:///data/data/org.nativescript.abllapp/files/app/bundle.js:3319:47)
  System.err:   at (file:///data/data/org.nativescript.abllapp/files/app/bundle.js:3324:3)
  System.err:   at require(:1:266)
  System.err:

Example:

<script lang="ts" setup>
import {StackLayout} from "@nativescript/core";
</script>

<template>
  <Page actionBarHidden="true">
      <StackLayout>
      </StackLayout>
  </Page>
</template>

Metadata

Metadata

Assignees

No one assigned

    Labels

    V3Issues related to V3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions