NativeScript / nativescript-dev-webpack

A package to help with webpacking NativeScript apps.
Apache License 2.0
97 stars 49 forks source link

hiddenSourceMap broken in nativescript 6 #994

Closed james-criscuolo closed 5 years ago

james-criscuolo commented 5 years ago

Environment ✘  ~/n6-project  tns info ✔ Getting NativeScript components versions information... ✔ Component nativescript has 6.0.0 version and is up to date. ✔ Component tns-core-modules has 6.0.1 version and is up to date. ✔ Component tns-android has 6.0.0 version and is up to date. ✔ Component tns-ios has 6.0.1 version and is up to date. node: 10.16.0

The webpack and package.json configs are what is spit out from tns create

Describe the bug Using --env.hiddenSourceMap no longer works once upgrading to Nativescript 6

To Reproduce

tns create <project-name>
-angular app
-hello world
cd <project-name>
npm install && tns prepare android --compileSdk 28 && tns build android --compileSdk 28 && tns run android --compileSdk 28 --env.hiddenSourceMap
.
.
.
webpack is watching the files…

Hash: a327bf26850ded9d2735
Version: webpack 4.27.1
Time: 9047ms
Built at: 07/17/2019 12:04:43 PM
                                        Asset       Size   Chunks             Chunk Names
 ../../../../../../../sourceMap/bundle.js.map   14.8 KiB   bundle  [emitted]  bundle
../../../../../../../sourceMap/runtime.js.map   31.2 KiB  runtime  [emitted]  runtime
 ../../../../../../../sourceMap/vendor.js.map   5.87 MiB   vendor  [emitted]  vendor
                                    bundle.js     19 KiB   bundle  [emitted]  bundle
                                 package.json  112 bytes           [emitted]
                                   runtime.js   29.8 KiB  runtime  [emitted]  runtime
                          tns-java-classes.js    0 bytes           [emitted]
                                    vendor.js   5.37 MiB   vendor  [emitted]  vendor
Entrypoint bundle = runtime.js ../../../../../../../sourceMap/runtime.js.map vendor.js ../../../../../../../sourceMap/vendor.js.map bundle.js ../../../../../../../sourceMap/bundle.js.map
[../$$_lazy_route_resource lazy recursive] ../$$_lazy_route_resource lazy namespace object 160 bytes {bundle} [built]
[./app.css] 918 bytes {bundle} [built]
[./app/app-routing.module.ts] 784 bytes {bundle} [built]
[./app/app.component.html] 167 bytes {bundle} [built]
[./app/app.component.ts] 354 bytes {bundle} [built]
[./app/app.module.ts] 1.51 KiB {bundle} [built]
[./app/item/item-detail.component.html] 394 bytes {bundle} [built]
[./app/item/item-detail.component.ts] 977 bytes {bundle} [built]
[./app/item/item.service.ts] 1.59 KiB {bundle} [built]
[./app/item/items.component.html] 1.68 KiB {bundle} [built]
[./app/item/items.component.ts] 1010 bytes {bundle} [built]
[./main.ts] 2.36 KiB {bundle} [built]
[./package.json] 100 bytes {bundle} [optional] [built]
    + 420 hidden modules
Webpack compilation complete. Watching for file changes.
Webpack build done!
Project successfully prepared (android)
Installing on device emulator-5554...
Successfully installed on device with identifier 'emulator-5554'.
Successfully transferred bundle.js on device emulator-5554.
Successfully transferred runtime.js on device emulator-5554.
Successfully transferred vendor.js on device emulator-5554.
Restarting application on device emulator-5554...
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: Error: com.tns.NativeScriptException: Failed to find module: "./../../../../../../../sourceMap/runtime.js.map", relative to: app/
System.err:     com.tns.Module.resolvePathHelper(Module.java:151)
System.err:     com.tns.Module.resolvePath(Module.java:56)
System.err:     com.tns.Runtime.runModule(Native Method)
System.err:     com.tns.Runtime.runModule(Runtime.java:663)
System.err:     com.tns.Runtime.run(Runtime.java:655)
System.err:     com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
System.err:     android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
System.err:     android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
System.err:     android.app.ActivityThread.access$1100(ActivityThread.java:199)
System.err:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
System.err:     android.os.Handler.dispatchMessage(Handler.java:106)
System.err:     android.os.Looper.loop(Looper.java:193)
System.err:     android.app.ActivityThread.main(ActivityThread.java:6669)
System.err:     java.lang.reflect.Method.invoke(Native Method)
System.err:     com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
System.err: File: "<unknown>, line: 1, column: 265
System.err:
System.err: StackTrace:
System.err:     Frame: function:'require', file:'', line: 1, column: 266
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.n6project/files/app/bundle.js', line: 1, column: 85
System.err:     Frame: function:'require', file:'', line: 1, column: 266
System.err:
System.err:
System.err: Error: com.tns.NativeScriptException: Failed to find module: "./../../../../../../../sourceMap/runtime.js.map", relative to: app/
System.err:     com.tns.Module.resolvePathHelper(Module.java:151)
System.err:     com.tns.Module.resolvePath(Module.java:56)
System.err:     com.tns.Runtime.runModule(Native Method)
System.err:     com.tns.Runtime.runModule(Runtime.java:663)
System.err:     com.tns.Runtime.run(Runtime.java:655)
System.err:     com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
System.err:     android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
System.err:     android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
System.err:     android.app.ActivityThread.access$1100(ActivityThread.java:199)
System.err:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
System.err:     android.os.Handler.dispatchMessage(Handler.java:106)
System.err:     android.os.Looper.loop(Looper.java:193)
System.err:     android.app.ActivityThread.main(ActivityThread.java:6669)
System.err:     java.lang.reflect.Method.invoke(Native Method)
System.err:     com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
System.err: Error: com.tns.NativeScriptException: Failed to find module: "./../../../../../../../sourceMap/runtime.js.map", relative to: app/
System.err:     com.tns.Module.resolvePathHelper(Module.java:151)
System.err:     com.tns.Module.resolvePath(Module.java:56)
System.err:     com.tns.Runtime.runModule(Native Method)
System.err:     com.tns.Runtime.runModule(Runtime.java:663)
System.err:     com.tns.Runtime.run(Runtime.java:655)
System.err:     com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
System.err:     android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
System.err:     android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
System.err:     android.app.ActivityThread.access$1100(ActivityThread.java:199)
System.err:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
System.err:     android.os.Handler.dispatchMessage(Handler.java:106)
System.err:     android.os.Looper.loop(Looper.java:193)
System.err:     android.app.ActivityThread.main(ActivityThread.java:6669)
System.err:     java.lang.reflect.Method.invoke(Native Method)
System.err:     com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
System.err: File: "<unknown>, line: 1, column: 265
System.err:
System.err: StackTrace:
System.err:     Frame: function:'require', file:'', line: 1, column: 266
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.n6project/files/app/bundle.js', line: 1, column: 85
System.err:     Frame: function:'require', file:'', line: 1, column: 266
System.err:
System.err:
System.err: Error: com.tns.NativeScriptException: Failed to find module: "./../../../../../../../sourceMap/runtime.js.map", relative to: app/
System.err:     com.tns.Module.resolvePathHelper(Module.java:151)
System.err:     com.tns.Module.resolvePath(Module.java:56)
System.err:     com.tns.Runtime.runModule(Native Method)
System.err:     com.tns.Runtime.runModule(Runtime.java:663)
System.err:     com.tns.Runtime.run(Runtime.java:655)
System.err:     com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
System.err:     android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
System.err:     android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
System.err:     android.app.ActivityThread.access$1100(ActivityThread.java:199)
System.err:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
System.err:     android.os.Handler.dispatchMessage(Handler.java:106)
System.err:     android.os.Looper.loop(Looper.java:193)
System.err:     android.app.ActivityThread.main(ActivityThread.java:6669)
System.err:     java.lang.reflect.Method.invoke(Native Method)
System.err:     com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
System.err:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5876)
System.err:     at android.app.ActivityThread.access$1100(ActivityThread.java:199)
System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
System.err:     at android.os.Looper.loop(Looper.java:193)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:6669)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
System.err: Caused by: com.tns.NativeScriptException: Error calling module function
System.err: Error: com.tns.NativeScriptException: Failed to find module: "./../../../../../../../sourceMap/runtime.js.map", relative to: app/
System.err:     com.tns.Module.resolvePathHelper(Module.java:151)
System.err:     com.tns.Module.resolvePath(Module.java:56)
System.err:     com.tns.Runtime.runModule(Native Method)
System.err:     com.tns.Runtime.runModule(Runtime.java:663)
System.err:     com.tns.Runtime.run(Runtime.java:655)
System.err:     com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
System.err:     android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
System.err:     android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
System.err:     android.app.ActivityThread.access$1100(ActivityThread.java:199)
System.err:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
System.err:     android.os.Handler.dispatchMessage(Handler.java:106)
System.err:     android.os.Looper.loop(Looper.java:193)
System.err:     android.app.ActivityThread.main(ActivityThread.java:6669)
System.err:     java.lang.reflect.Method.invoke(Native Method)
System.err:     com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
System.err: File: "<unknown>, line: 1, column: 265
System.err:
System.err: StackTrace:
System.err:     Frame: function:'require', file:'', line: 1, column: 266
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.n6project/files/app/bundle.js', line: 1, column: 85
System.err:     Frame: function:'require', file:'', line: 1, column: 266
System.err:
System.err:
System.err: Error: com.tns.NativeScriptException: Failed to find module: "./../../../../../../../sourceMap/runtime.js.map", relative to: app/
System.err:     com.tns.Module.resolvePathHelper(Module.java:151)
System.err:     com.tns.Module.resolvePath(Module.java:56)
System.err:     com.tns.Runtime.runModule(Native Method)
System.err:     com.tns.Runtime.runModule(Runtime.java:663)
System.err:     com.tns.Runtime.run(Runtime.java:655)
System.err:     com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
System.err:     android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
System.err:     android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
System.err:     android.app.ActivityThread.access$1100(ActivityThread.java:199)
System.err:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
System.err:     android.os.Handler.dispatchMessage(Handler.java:106)
System.err:     android.os.Looper.loop(Looper.java:193)
System.err:     android.app.ActivityThread.main(ActivityThread.java:6669)
System.err:     java.lang.reflect.Method.invoke(Native Method)
System.err:     com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
System.err:     at com.tns.Runtime.runModule(Native Method)
System.err:     at com.tns.Runtime.runModule(Runtime.java:663)
System.err:     at com.tns.Runtime.run(Runtime.java:655)
System.err:     at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
System.err:     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
System.err:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
System.err:     ... 8 more

Expected behavior Does not crash on load Sample project See above, easy to create from nothing with tns create

Additional context I recognize #968 and #976 exist, but neither reference that built-in functionality is broken, so I figured it was worth a new issue.

Fatme commented 5 years ago

@james-criscuolo,

Thank you for reporting this issue!

It was indeed a bug on our side. We've already fixed it in release brach so you can give it a try using npm i -D nativescript-dev-webpack@rc. It'll be released with nativescript-dev-webpack@1.0.2 which is planned for the next week.

james-criscuolo commented 5 years ago

I can confirm that this worked when using the @rc version, thanks!