Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Bundled application can't find "ui/web-view", but "tns run" can. #79

Closed
m-abs opened this issue Feb 22, 2017 · 1 comment · Fixed by #90
Closed

Bundled application can't find "ui/web-view", but "tns run" can. #79

m-abs opened this issue Feb 22, 2017 · 1 comment · Fixed by #90

Comments

@m-abs
Copy link

m-abs commented Feb 22, 2017

I've encountered this problem and it took me a long time to work out.

I've a WebView in my application, during development running with tns run android everything worked fine.
But the moment I tried to run the project with bundling I got an error like this:

Stacktrace:

JS: TypeError: Could not load view for: webview.Error: Cannot find module "ui/web-view"
JS:     at Object.getViewClass (file:///data/data/org.nativescript.myhalloworld/files/app/vendor.js:51335:15)
JS:     at ViewUtil.module.exports.ViewUtil.createView (file:///data/data/org.nativescript.myhalloworld/files/app/vendor.js:52819:48)
JS:     at NativeScriptRenderer.module.exports.NativeScriptRenderer.createElement (file:///data/data/org.nativescript.myhalloworld/files/app/vendor.js:52092:30)
JS:     at Object.createRenderElement (file:///data/data/org.nativescript.myhalloworld/files/app/vendor.js:10223:40)
JS:     at View_AppComponent0.module.exports.webpackJsonp.400.View_AppComponent0.createInternal (file:///data/data/org.nativescript.myhalloworld/files/app/bundle.js:477:111)
JS:     at View_AppComponent0.module.exports.AppView.create (file:///data/data/org.nativescript.myhalloworld/files/app/vendor.js:32518:21)
JS:     at View_AppComponent_Host0.module.exports.webpackJsonp.400.View_AppComponent_Host0.createInternal (file:///data/data/org.nativescript.myhalloworld/files/app/bundle.js:428:25)
JS:     at View_AppComponent_Host0.module.exports.AppView.createHostView (file:///data/data/org.nativescript.myhalloworld/files/app/vendor.js:32531:21)
JS:     at ComponentFactory.module.exports.ComponentFactory.create (file:///data/data/org.nativescript.myhalloworld/files/app/vendor.js:15767:25)
JS:     at ApplicationRef_.module.exports.ApplicationRef_.bootstrap (file:///data/data/org.nativescript.myhalloworld/files/app/vendor.js:20718:57)

After a lot of hard work I found that it was caused by me writing the tagname in all lowercase like this:

   <webview  height="300" width="400" src="http://google.dk"></webview>

But all these cases works as expected:

    <WebView  height="300" width="400" src="http://google.dk"></WebView>
    <Web-View height="300" width="400" src="http://google.dk"></Web-View>
    <web-view height="300" width="400" src="http://google.dk"></web-view>

Example here:

https://github.com/m-abs/tns-webpack-ng2.3/tree/bundle-tag-casing

Steps to reproduce:

  • Checkout out the code
  • run: npm i
  • run: npm run start.android.bundle

This app should crash with the error above, but if you try this:

  • run: rm -rf platforms
  • run: tns run android
    It should show the WebView as expected.

It would be great if both tns run android/ios and npm run start.android.bundle behaved the same here, so all four cases would work the same in both.

sis0k0 added a commit that referenced this issue Feb 28, 2017
Migration: remove the loader and plugin from your webpack config

closes #79, #88
sis0k0 added a commit that referenced this issue Feb 28, 2017
Migration: remove the loader and plugin from your webpack config

closes #79, #88
@sis0k0
Copy link
Contributor

sis0k0 commented Feb 28, 2017

Both ways should now work with all lowercase letters.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants