hypery2k / nativescript-urlhandler

NativeScript URL Handler Plugin
MIT License
52 stars 34 forks source link

Plugin fails to load for Vue project #155

Open dcolley opened 1 year ago

dcolley commented 1 year ago

Prerequisites

Please answer the following questions for yourself before submitting an issue.

Current Behavior

Following the instructions but plugin fails to load and reports error

Expected Behavior

The plugin should load and fire during app startup

Failure Information

Added the plugin as follows: tns plugin add nativescript-urlhandler package.json says: "nativescript-urlhandler": "^1.3.0",

This is my app.js:

import Vue from 'nativescript-vue'
import RadSideDrawer from 'nativescript-ui-sidedrawer/vue'
Vue.use(RadSideDrawer)

import { handleOpenURL } from "nativescript-urlhandler" // .handleOpenURL;
import App from './components/App'

Vue.config.silent = !__DEV__

new Vue({
  render: h => h(App),
  created() {
    // handleOpenURL(url) => { console.log('handleOpenUrl', url) }
    handleOpenURL(function(appURL) {
      console.log('Got the following appURL', appURL);
    });
}
}).$start()

Can't start the app:

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. create a new project
  2. add the plugin
  3. use the app.js from above

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

NativeScript version: nativescript/core 8.3.0 Java version: n/a NodeJS and NPM version: Tried on node 16 and node 18 Platform(s) running: Xcode Version 13.4.1 (13F100)

Demo Project

ℹ Please link to or upload a project we can download that reproduces the issue. https://github.com/dcolley/ns-vue-urlhandler

Failure Logs

$ ns run ios

ERROR in ./app/app.js 6:0-55
Module not found: Error: Can't resolve 'nativescript-urlhandler' in '/Users/derek/demoproj/example-app2/app'
resolve 'nativescript-urlhandler' in '/Users/derek/demoproj/example-app2/app'
  Parsed request is a module
  using description file: /Users/derek/demoproj/example-app2/package.json (relative path: ./app)
    resolve as module
      looking for modules in /Users/derek/demoproj/example-app2/node_modules
        single file module
          using description file: /Users/derek/demoproj/example-app2/package.json (relative path: ./node_modules/nativescript-urlhandler)
            no extension
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler doesn't exist
            .ios.vue
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.vue doesn't exist
            .vue
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.vue doesn't exist
            .ios.ts
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.ts doesn't exist
            .ts
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ts doesn't exist
            .ios.js
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.js doesn't exist
            .js
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.js doesn't exist
            .ios.mjs
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.mjs doesn't exist
            .mjs
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.mjs doesn't exist
            .ios.css
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.css doesn't exist
            .css
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.css doesn't exist
            .ios.scss
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.scss doesn't exist
            .scss
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.scss doesn't exist
            .ios.json
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.json doesn't exist
            .json
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.json doesn't exist
        /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler doesn't exist
      /Users/derek/demoproj/example-app2/app/node_modules doesn't exist or is not a directory
      looking for modules in /Users/derek/demoproj/example-app2/node_modules
        single file module
          using description file: /Users/derek/demoproj/example-app2/package.json (relative path: ./node_modules/nativescript-urlhandler)
            no extension
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler doesn't exist
            .ios.vue
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.vue doesn't exist
            .vue
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.vue doesn't exist
            .ios.ts
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.ts doesn't exist
            .ts
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ts doesn't exist
            .ios.js
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.js doesn't exist
            .js
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.js doesn't exist
            .ios.mjs
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.mjs doesn't exist
            .mjs
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.mjs doesn't exist
            .ios.css
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.css doesn't exist
            .css
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.css doesn't exist
            .ios.scss
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.scss doesn't exist
            .scss
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.scss doesn't exist
            .ios.json
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.ios.json doesn't exist
            .json
              /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler.json doesn't exist
        /Users/derek/demoproj/example-app2/node_modules/nativescript-urlhandler doesn't exist
      /Users/derek/demoproj/node_modules doesn't exist or is not a directory
      /Users/derek/metaspan/node_modules doesn't exist or is not a directory
      /Users/derek/node_modules doesn't exist or is not a directory
      /Users/derek/node_modules doesn't exist or is not a directory
      /Users/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory

webpack 5.74.0 compiled with 1 error in 222 ms
Webpack compilation complete. Watching for file changes.
hypery2k commented 1 year ago

With NS7+ the import scheme has changed. Actually I don't have much time for maintaining this plugin. I will give it a try, but only a small time box.

Sorry for that, but my free time for open source project is very limited, as I'm not getting money for that ...