Notalib / nativescript-webview-ext

Nativescript plugin with extended WebView functionality
Apache License 2.0
76 stars 37 forks source link

Error when using it within NativeScript 8 #112

Closed LouieTian0209 closed 3 years ago

LouieTian0209 commented 3 years ago

Installed it in my project which uses NS8 + Angular. Imported the module in NgModule. Everything is fine so far. As soon as I start using in my HTML/XML files, the following errors occur:

JS: ERROR Error: Uncaught (in promise): TypeError: Could not load view for: WebViewExt.Error: com.tns.NativeScriptException: Failed to find module: "url", relative to: app/tns_modules/
JS: TypeError: Could not load view for: WebViewExt.Error: com.tns.NativeScriptException: Failed to find module: "url", relative to: app/tns_modules/
JS:     at getViewClass (file: src/webpack:/my-project/node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:1741:0)
JS:     at ViewUtil.createView (file: src/webpack:/my-project/node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:2583:0)
JS:     at EmulatedRenderer.createElement (file: src/webpack:/my-project/node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:2784:0)
JS:     at EmulatedRenderer.createElement (file: src/webpack:/my-project/node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:3001:0)
JS:     at createElementNode (file: src/webpack:/my-project/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:7008:0)
JS:     at Module.ɵɵelementStart (file: src/webpack:/my-project/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:14748:0)
JS:     at FindDealerTabComponent_Template (file:...

Is it because that this plugin isn't compatible with NS8 yet? If so, what's an alternative way to obtain target url when tapping in WebView as so far the src attribute value doesn't change even if the actual url changed in WebView?

JohnpeterDairianadan commented 3 years ago

I too encountered this issue yesterday. I have got this on Android with Vue template. It was working well on NSv7. Please give some direction. Is it related to nativescript v8?, I tried with plugin v7.0.1, its same. So must be related to NSv8.how could we resolve this ?

m-abs commented 3 years ago

Thank you for reporting this, I'm working on a new release for nativescript 8.

m-abs commented 3 years ago

I'm having trouble getting the unittests to even run on nativescript 8 and I'm short for time.

I've published an alpha, could you try @nota/nativescript-webview-ext@8.0.0-alpha.0?

RGBvision commented 3 years ago

Same error with 8.0.0-alpha.0 System.err: > Module '@nota/nativescript-webview-ext' not found for element '@nota/nativescript-webview-ext:WebViewExt'. System.err: > com.tns.NativeScriptException: Failed to find module: "url", relative to: app/tns_modules/

m-abs commented 3 years ago

That is really strange "url" is a dependency to the plugin and so it should be available.

RGBvision commented 3 years ago

Reinstalling and updating all modules solved the problem. 8.0.0-alpha.0 works fine on Android with:

"@nativescript/core": "8.0.3"
"@nativescript/theme": "3.0.1"
"@nota/nativescript-webview-ext": "8.0.0-alpha.0"
"@nativescript/android": "8.0.0"
"@nativescript/webpack": "5.0.0-beta.9"
m-abs commented 3 years ago

Good to know, thank you :)

Might have been a messed up package-lock.json

m-abs commented 3 years ago

I've published v8.0.0 now.

Bezlepkin commented 3 years ago

"@nota/nativescript-webview-ext": "^8.0.0",

I have same issue

ERROR TypeError: Could not load view for: WebViewExt.Error: com.tns.NativeScriptException: Failed to find module: "url", relative to: app/tns_modules/

tskweres commented 3 years ago

Does anyone have a working example in Angular?

Also if I want to use a local HTML file, where should I put it, root of project? src? App Resources?

Thanks.

tiagocmachado commented 3 years ago

Not working for me either.

PabloPG commented 2 years ago

Does anyone have a working example in Angular?

Also if I want to use a local HTML file, where should I put it, root of project? src? App Resources?

Thanks.

Did you manage to use it? Do you have sample code?