js-base64 icon indicating copy to clipboard operation
js-base64 copied to clipboard

stopped working in nativescript after update

Open ray007 opened this issue 4 years ago • 2 comments

This may not be a tested target environment, but it worked fine before the update with version 3.3.2. After updating to version 3.4.5, I'm getting an exception:

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: "./../buffer/index.js", relative to: app/
System.err: File: (<unknown>:1:265)
System.err:
System.err: StackTrace:
System.err: require(:1:266)
System.err:     at ../node_modules/js-base64/base64.mjs(file:///data/data/com.loytec.lweb804/files/app/vendor.js:77818:41)
System.err:     at __webpack_require__(file: app\webpack\bootstrap:750:0)
System.err:     at fn(file: app\webpack\bootstrap:120:0)
System.err:     at (file:///data/data/com.loytec.lweb804/files/app/bundle.js:15:67)
System.err:     at ../node_modules/babel-loader/lib/index.js!../node_modules/vue-loader/lib/index.js?!./components/Home.vue?vue&type=script&lang=js&(file:///data/data/com.loytec.lweb804/files/app/bundle.js:822:30)
System.err:     at __webpack_require__(file: app\webpack\bootstrap:750:0)
System.err:     at fn(file: app\webpack\bootstrap:120:0)
System.err:     at ./components/Home.vue?vue&type=script&lang=js&(file: app\components\Home.vue?5625:1:0)
System.err:     at __webpack_require__(file: app\webpack\bootstrap:750:0)
System.err:     at fn(file: app\webpack\bootstrap:120:0)
System.err:     at ./components/Home.vue(file: app\components\Home.vue:1:0)
System.err:     at __webpack_require__(file: app\webpack\bootstrap:750:0)
System.err:     at fn(file: app\webpack\bootstrap:120:0)
System.err:     at (file: app\app.js:2:0)
System.err:     at ./app.js(file:///data/data/com.loytec.lweb804/files/app/bundle.js:1957:30)
System.err:     at __webpack_require__(file: app\webpack\bootstrap:750:0)
System.err:     at checkDeferredModules(file: app\webpack\bootstrap:43:0)
System.err:     at webpackJsonpCallback(file: app\webpack\bootstrap:30:0)
System.err:     at (file:///data/data/com.loytec.lweb804/files/app/bundle.js:2:57)
System.err:     at require(:1:266)
System.err:
System.err:
System.err: Error: com.tns.NativeScriptException: Failed to find module: "./../buffer/index.js", relative to: app/

ray007 avatar Aug 17 '20 09:08 ray007

Looks to me your app tries to require('buffer') even though base64.mjs DOES NOT require() anything at all. It does, from version 3.4, however, check the presence of of the built-in Buffer and use it if available.

I've found similar claims:

https://www.google.com/search?client=firefox-b-d&q=NativeScript+Failed+to+find+module%3A+%22.%2F..%2Fbuffer%2Findex.js%22

Looks to me it is NativeScripts' fault to trying to require a module not demanded.

dankogai avatar Aug 17 '20 11:08 dankogai

It may well be the fault of nativescript somehow, but the fact remains that something must have changed in js-base64 since the upgrade of this module only triggered the problem. If you know what you did change with the buffer, maybe we could tell the nativescript guys how to fix it?

Edit: ah, just read your comment again, so check for Buffer seems to trigger the problem?

ray007 avatar Aug 18 '20 09:08 ray007