Title: Global 'document' polyfill causes crashes when used with some node packages · Issue #1144 · NativeScript/nativescript-angular · GitHub
Open Graph Title: Global 'document' polyfill causes crashes when used with some node packages · Issue #1144 · NativeScript/nativescript-angular
X Title: Global 'document' polyfill causes crashes when used with some node packages · Issue #1144 · NativeScript/nativescript-angular
Description: With 5.0.0, a dependency I was using now causes an exception. Switching back to 4.*.* fixes the issue. In my case I'm using fuzzball, whose default module has a dependency tree with node standard modules that are not available in Natives...
Open Graph Description: With 5.0.0, a dependency I was using now causes an exception. Switching back to 4.*.* fixes the issue. In my case I'm using fuzzball, whose default module has a dependency tree with node standard m...
X Description: With 5.0.0, a dependency I was using now causes an exception. Switching back to 4.*.* fixes the issue. In my case I'm using fuzzball, whose default module has a dependency tree with node standa...
Opengraph URL: https://github.com/NativeScript/nativescript-angular/issues/1144
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Global 'document' polyfill causes crashes when used with some node packages","articleBody":"With `5.0.0`, a dependency I was using now causes an exception. Switching back to `4.*.*` fixes the issue. In my case I'm using fuzzball, whose default module has a dependency tree with node standard modules that are not available in Nativescript. Instead, I'm using the minified umd version which has worked up until `nativescript-angular: 5.0.0` and Angular 5. Here is the stack trace for iOS:\r\n\r\n```\r\n***** Fatal JavaScript exception - application has been terminated. *****\r\nNative stack trace:\r\n1 0x10fce57b4 -[TNSRuntime executeModule:referredBy:]\r\n2 0x10f7dbc71 main\r\n3 0x11377565d start\r\nJavaScript stack trace:\r\n1 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:5:14902\r\n2 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:5:15068\r\n3 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:5:15147\r\n4 s@file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:693\r\n5 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:741\r\n6 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:1893\r\n7 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:17113\r\n8 s@file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:693\r\n9 e@file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:861\r\n10 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:877\r\n11 @file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:159\r\n12 anonymous@file:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:1:392\r\n13 evaluate@[native code]\r\n14 moduleEvaluation@[native code]\r\n15 @[native code]\r\n16 promiseReactionJob@[native code]\r\n17 require@[native code]\r\n18 anonymous@file:///app/app.component.js:4:23\r\n19 evaluate@[native code]\r\n20 moduleEvaluation@[native code]\r\n21 @[native code]\r\n22 promiseReactionJob@[native code]\r\n23 require@[native code]\r\n24 anonymous@file:///app/app.module.js:6:30\r\n25 evaluate@[native code]\r\n26 moduleEvaluation@[native code]\r\n27 @[native code]\r\n28 promiseReactionJob@[native code]\r\n29 require@[native code]\r\n30 anonymous@file:///app/main.js:5:27\r\n31 evaluate@[native code]\r\n32 moduleEvaluation@[native code]\r\n33 @[native code]\r\n34 promiseReactionJob@[native code]\r\nJavaScript error:\r\nfile:///app/tns_modules/fuzzball/dist/fuzzball.umd.min.js:5:14902: JS ERROR TypeError: doc.createElement is not a function. (In 'doc.createElement(\"script\")', 'doc.createElement' is undefined)\r\n```\r\n\r\nI'm including a sample project whose package.json you can change to the following in order to no longer get this error:\r\n```\r\n{\r\n \"description\": \"NativeScript Application\",\r\n \"license\": \"SEE LICENSE IN \u003cyour-license-filename>\",\r\n \"readme\": \"NativeScript Application\",\r\n \"repository\": \"\u003cfill-your-repository-here>\",\r\n \"nativescript\": {\r\n \"id\": \"org.nativescript.dependencyerror\",\r\n \"tns-ios\": {\r\n \"version\": \"3.4.0\"\r\n }\r\n },\r\n \"dependencies\": {\r\n \"@angular/animations\": \"~4.4.6\",\r\n \"@angular/common\": \"~4.4.6\",\r\n \"@angular/compiler\": \"~4.4.6\",\r\n \"@angular/core\": \"~4.4.6\",\r\n \"@angular/forms\": \"~4.4.6\",\r\n \"@angular/http\": \"~4.4.6\",\r\n \"@angular/platform-browser\": \"~4.4.6\",\r\n \"@angular/platform-browser-dynamic\": \"~4.4.6\",\r\n \"@angular/router\": \"~4.4.6\",\r\n \"allow-publish\": \"^1.0.4\",\r\n \"fuzzball\": \"^0.13.6\",\r\n \"nativescript-angular\": \"~4.4.1\",\r\n \"nativescript-theme-core\": \"~1.0.4\",\r\n \"reflect-metadata\": \"~0.1.8\",\r\n \"rxjs\": \"~5.5.2\",\r\n \"tns-core-modules\": \"~3.4.0\",\r\n \"zone.js\": \"~0.8.2\"\r\n },\r\n \"devDependencies\": {\r\n \"nativescript-dev-typescript\": \"~0.5.0\",\r\n \"typescript\": \"~2.4.2\"\r\n }\r\n}\r\n```\r\n\r\nFinally, here is the unminified version of the block that fails:\r\n```\r\nif ({}.toString.call(global.process) === \"[object process]\") {\r\n installNextTickImplementation()\r\n} else if (canUsePostMessage()) {\r\n installPostMessageImplementation()\r\n} else if (global.MessageChannel) {\r\n installMessageChannelImplementation()\r\n} else if (doc && \"onreadystatechange\" in doc.createElement(\"script\")) {\r\n installReadyStateChangeImplementation()\r\n} else {\r\n installSetTimeoutImplementation()\r\n}\r\n```\r\n\r\nEdit:\r\nAttaching project. Also, this error can be fixed by changing the line\r\n```else if (doc && \"onreadystatechange\" in doc.createElement(\"script\"))```\r\nto \r\n```else if (doc && document.createElement && \"onreadystatechange\" in doc.createElement(\"script\"))```\r\n[dependency-error.zip](https://github.com/NativeScript/nativescript-angular/files/1593459/dependency-error.zip)\r\n\r\n","author":{"url":"https://github.com/vcooley","@type":"Person","name":"vcooley"},"datePublished":"2017-12-29T15:55:38Z","url":"https://github.com/NativeScript/nativescript-angular/issues/1144"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:19bee94b-98ba-7679-6f2a-d221e142f244 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F2E:A71F9:13F3ED5:191F3A5:6B016187 |
| html-safe-nonce | 2af8b447a7f4f056356259ef608838346062498a709a8dfa2085664084fdeb8f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjJFOkE3MUY5OjEzRjNFRDU6MTkxRjNBNTo2QjAxNjE4NyIsInZpc2l0b3JfaWQiOiI0MjI3MjMzMTAzNzM2ODI0MTk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8fba11decbd0daad7ad41ef67fb7a672c7b7a0f3550d4feb5cc28e8a67f0957e |
| hovercard-subject-tag | issue:285114866 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/nativescript-angular/1144/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6e715569288ca69ac8b68f54b75df3390f6663a112c3d7d907b004bee2dbb547/NativeScript/nativescript-angular/issues/1144 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6e715569288ca69ac8b68f54b75df3390f6663a112c3d7d907b004bee2dbb547/NativeScript/nativescript-angular/issues/1144 |
| og:image:alt | With 5.0.0, a dependency I was using now causes an exception. Switching back to 4.*.* fixes the issue. In my case I'm using fuzzball, whose default module has a dependency tree with node standard m... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vcooley |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/nativescript-angular git https://github.com/NativeScript/nativescript-angular.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 35951404 |
| octolytics-dimension-repository_nwo | NativeScript/nativescript-angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 35951404 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/nativescript-angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width