Android
The process
global, available in node, isn't shimmed in NS, and it fails in some node_modules. there's no way to shim it either (either by using global.process
, it doesn't injects to the require'd module)
package.json
{
"dependencies": {
"@google/maps": "^0.3.0",
}
}
import { createClient } from '@google/maps'
const client = createClient({
key: 'somekey'
})
client.geocode({ address: 'Washington, DC' }, () => {
})
crashes with:
W/System.err( 6682): Calling js method onCreateView failed
W/System.err( 6682): ReferenceError: process is not defined
W/System.err( 6682): File: "/data/data/org.nativescript.cadastramento/files/app/tns_modules/@google/maps/lib/internal/make-api-call.js, line: 25, column: 37
W/System.err( 6682): StackTrace:
W/System.err( 6682): Frame: function:'exports.inject', file:'/data/data/org.nativescript.cadastramento/files/app/tns_modules/@google/maps/lib/internal/make-api-call.js', line: 25, column: 38
W/System.err( 6682): Frame: function:'exports.createClient', file:'/data/data/org.nativescript.cadastramento/files/app/tns_modules/@google/maps/lib/index.js', line: 47, column: 57
tried to shim it in app.ts
import * as app from 'application'
import * as process from 'process/browser'
global.process = process
app.start({ moduleName: 'views/main' });
seems the globals doesn't get injected in require'd files
Hey @pocesar,
process
is node specific and cannot be used in NativeScript app.
@enchev browserify and others shim node specific code for the browser, so at least they don't break when trying to bundle. consider learning from them, will make NS more compatible with modules that have process.env
in them
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
@enchev browserify and others shim node specific code for the browser, so at least they don't break when trying to bundle. consider learning from them, will make NS more compatible with modules that have
process.env
in them