Title: Polyfill is not defined when using `spago bundle-app` · Issue #34 · purescript-contrib/purescript-arraybuffer · GitHub
Open Graph Title: Polyfill is not defined when using `spago bundle-app` · Issue #34 · purescript-contrib/purescript-arraybuffer
X Title: Polyfill is not defined when using `spago bundle-app` · Issue #34 · purescript-contrib/purescript-arraybuffer
Description: Describe the bug polyFill function is not exported from Typed.js, but called at the top-level of Typed.js itself. This seems to cause issues with bundling, where the definition isn't picked up by the bundle, causing the top-level polyFil...
Open Graph Description: Describe the bug polyFill function is not exported from Typed.js, but called at the top-level of Typed.js itself. This seems to cause issues with bundling, where the definition isn't picked up by t...
X Description: Describe the bug polyFill function is not exported from Typed.js, but called at the top-level of Typed.js itself. This seems to cause issues with bundling, where the definition isn't picked up ...
Opengraph URL: https://github.com/purescript-contrib/purescript-arraybuffer/issues/34
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Polyfill is not defined when using `spago bundle-app`","articleBody":"**Describe the bug**\r\n`polyFill` function is not exported from `Typed.js`, but called at the top-level of `Typed.js` itself. This seems to cause issues with bundling, where the definition isn't picked up by the bundle, causing the top-level `polyFill()` call to report `Uncaught ReferenceError: polyFill is not defined`.\r\n\r\n**To Reproduce**\r\nInitialize a spago project via `spago init`. Add the following list of dependencies to `spago.dhall`:\r\n```\r\n [ \"arraybuffer\"\r\n , \"arraybuffer-types\"\r\n , \"console\"\r\n , \"effect\"\r\n , \"prelude\"\r\n , \"psci-support\"\r\n ]\r\n```\r\n\r\nModify `src/Main.purs` to be as follows:\r\n```purescript\r\n-- src/Main.purs\r\nmodule Main where\r\n\r\nimport Prelude\r\n\r\nimport Data.ArrayBuffer.Types (ArrayView, Int32)\r\nimport Data.ArrayBuffer.Typed as ArrayBuffer\r\nimport Effect (Effect)\r\nimport Effect.Console (log)\r\n\r\nmain :: Effect Unit\r\nmain = do\r\n _ :: ArrayView Int32 \u003c- ArrayBuffer.empty 0\r\n log \"hello\"\r\n```\r\n\r\nBundle it and run it via `node`:\r\n```bash\r\n$ spago bundle-app\r\n$ node index.js\r\n```\r\n\r\n**Expected behavior**\r\nSee the output: `\"hello\"`.\r\n\r\n**Actual behavior**\r\n```\r\n\u003cpath-to-project>\\index.js:6\r\n polyFill();\r\n ^\r\n\r\nReferenceError: polyFill is not defined\r\n```\r\n\r\n\r\n**Additional context**\r\nRunning the bundle through browser or node does not make a difference, failing in both cases.\r\n","author":{"url":"https://github.com/ozkutuk","@type":"Person","name":"ozkutuk"},"datePublished":"2021-08-30T22:15:18Z","url":"https://github.com/purescript-contrib/purescript-arraybuffer/issues/34"}
| 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:ecaaf689-7e93-2a28-7128-5fe1aef05579 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E9E8:2ADDC2:26FDC7:3557C4:6AFC021D |
| html-safe-nonce | 9fa764dfc96fd2ed2593ceadd349d15e8122e85fd9932610904008217325cbe1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOUU4OjJBRERDMjoyNkZEQzc6MzU1N0M0OjZBRkMwMjFEIiwidmlzaXRvcl9pZCI6IjU1MDQyNzE5NDc2NTI2NjE3ODkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2ccbb790d35188b81e053ce1e44deca2f353e7f08cccf145e320cc2b3f81417c |
| hovercard-subject-tag | issue:983252573 |
| 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/purescript-contrib/purescript-arraybuffer/34/issue_layout |
| twitter:image | https://opengraph.githubassets.com/07df7ad9d81a215e34cce7b9f588ab6695e553a03c42bffbfd94d276debbd202/purescript-contrib/purescript-arraybuffer/issues/34 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/07df7ad9d81a215e34cce7b9f588ab6695e553a03c42bffbfd94d276debbd202/purescript-contrib/purescript-arraybuffer/issues/34 |
| og:image:alt | Describe the bug polyFill function is not exported from Typed.js, but called at the top-level of Typed.js itself. This seems to cause issues with bundling, where the definition isn't picked up by t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ozkutuk |
| hostname | github.com |
| expected-hostname | github.com |
| None | fa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f |
| turbo-cache-control | no-preview |
| go-import | github.com/purescript-contrib/purescript-arraybuffer git https://github.com/purescript-contrib/purescript-arraybuffer.git |
| octolytics-dimension-user_id | 7391813 |
| octolytics-dimension-user_login | purescript-contrib |
| octolytics-dimension-repository_id | 30353544 |
| octolytics-dimension-repository_nwo | purescript-contrib/purescript-arraybuffer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 30353544 |
| octolytics-dimension-repository_network_root_nwo | purescript-contrib/purescript-arraybuffer |
| 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 | b3b5633a74535d9c23385512d534c66c8fde1907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width