This is the most evil issue, according to GitHub issue numbering 👹 - sorry.
Unlike on iOS (where this works fine), including npm packages with a dot in the filename leads to a runtime error.
Please provide the following version numbers that your issue occurs with:
- CLI: 2.4.0
- Android runtime: 2.4.1
Did the error happen while the app was executing? (runtime error)
At line 128 in main-view-model.js I'm requiring the hash.js package (see the example below), which leads to this stacktrace:
12-27 17:05:27.659 26878 26878 W System.err: Cannot compile /data/data/org.nativescript.starter/files/app/tns_modules/hash.js
12-27 17:05:27.659 26878 26878 W System.err:
12-27 17:05:27.659 26878 26878 W System.err: SyntaxError: Unexpected token ;
12-27 17:05:27.659 26878 26878 W System.err: File: "/data/data/org.nativescript.starter/files/app/tns_modules/hash.js, line: 46, column: 5
12-27 17:05:27.659 26878 26878 W System.err:
12-27 17:05:27.659 26878 26878 W System.err: StackTrace:
12-27 17:05:27.660 26878 26878 W System.err: Frame: function:'require', file:'', line: 1, column: 266
12-27 17:05:27.660 26878 26878 W System.err: Frame: function:'DemoAppModel.nodeUUID', file:'/data/data/org.nativescript.starter/files/app/main-view-model.js', line: 128, column: 15
12-27 17:05:27.660 26878 26878 W System.err: Frame: function:'Observable.notify', file:'/data/data/org.nativescript.starter/files/app/tns_modules/data/observable/observable.js', line: 146, column: 32
12-27 17:05:27.660 26878 26878 W System.err: Frame: function:'Observable._emit', file:'/data/data/org.nativescript.starter/files/app/tns_modules/data/observable/observable.js', line: 168, column: 18
12-27 17:05:27.660 26878 26878 W System.err: Frame: function:'onClick', file:'/data/data/org.nativescript.starter/files/app/tns_modules/ui/button/button.js', line: 33, column: 32
So it looks like the runtime tries to parse a folder as a file..
Please tell us how to recreate the issue in as much detail as possible.
Example:
package.json
"dependencies": {
"hash.js": "1.0.3"
}
main-view-model.js
// main-view-model.js
require('hash.js')
Possible cause
As far as I can see from the code in this repo the problem is somewhere in this file. The code checks for '.js' extension, but may also need to check on file vs folder.
This is the most evil issue, according to GitHub issue numbering 👹 - sorry.
Unlike on iOS (where this works fine), including npm packages with a dot in the filename leads to a runtime error.
Please provide the following version numbers that your issue occurs with:
Did the error happen while the app was executing? (runtime error)
At line 128 in
main-view-model.jsI'm requiring thehash.jspackage (see the example below), which leads to this stacktrace:So it looks like the runtime tries to parse a folder as a file..
Please tell us how to recreate the issue in as much detail as possible.
Example:
package.jsonmain-view-model.jsPossible cause
As far as I can see from the code in this repo the problem is somewhere in this file. The code checks for '.js' extension, but may also need to check on file vs folder.