-
Notifications
You must be signed in to change notification settings - Fork 14
Polyfill is not defined when using spago bundle-app
#34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Which version of |
Thanks for the bug report @ozkutuk ! Do you have any suggestions about how this should be solved? Do you think we should export the |
|
Reason why I ask is because of this issue: purescript/purescript#4044 |
The PR which @JordanMartinez mentioned purescript/purescript#4044 was merged and included in I just tried your bug reproduction steps with purs
purescript-arraybuffer wasn’t in package-sets for any |
Weird, |
@jamesdbrock It seems that purescript/purescript#4044 didn't make it into 0.14.3 release, so I am curious how this works on 0.14.3 at all. Maybe this was a regression that is present in the 0.14.4 release? I may downgrade the purs to 0.14.3 and try again, and report the results. |
I have bundled both with purs 0.14.3 and 0.14.4, and indeed it bundles and runs as expected on 0.14.3. To be sure that this is caused by purescript/purescript#4044, first I have compiled purs compiler on v0.14.4 tag myself and then got a bundle from that. Later, I have reverted the commit introducing purescript/purescript#4044 and rebuilt purs again, then getting another bundle output from the resulting purs executable. Indeed, the bundle of the latter purs executable contains the I will try to further analyze why this is the case. I am not really familiar with the purescript codebase but the Regarding the polyfill itself, caniuse.com reports that |
Oh yeah you're right purescript/purescript#4044 was introduced in So your test
|
Thanks all for the analysis! |
Here's another way to see this same bug. In a clone of
|
Here's some archeology |
We should try to come up with a solution in this library which doesn't depend on waiting for a new |
The `polyFill()` for TypedArray was causing problems with `purs bundle` v0.14.4. #34 The link which the `polyFill()` function referred to is dead. This link shows what appears to be a fully-functional TypedArray polyfill, which is not what we had in our library. Was our `polyFill()` even working at all? I don't know. https://github.com/zloirock/core-js#ecmascript-typed-arrays
The `polyFill()` for TypedArray was causing problems with `purs bundle` v0.14.4. #34 The link which the `polyFill()` function referred to is dead. This link shows what appears to be a fully-functional TypedArray polyfill, which is not what we had in our library. Was our `polyFill()` even working at all? I don't know. https://github.com/zloirock/core-js#ecmascript-typed-arrays
And here's all methods: https://caniuse.com/?search=typedarray |
As discussed in our call, we think a good way to handle this is to force users to handle the polyfill themselves. This is similar to what In other words, we would
|
The `polyFill()` for TypedArray was causing problems with `purs bundle` v0.14.4. #34 The reference link which the `polyFill()` function comments referred to is dead. Add a section on polyfills to the README, with new reference links.
Hi @ozkutuk I took your advice and just deleted the |
@jamesdbrock Why wasn't this published as a breaking release (e.g. |
Yeah, it should be a breaking release. |
I believe fixing this would mean doing the following:
Ideally, we could avoid this work by just checking out |
Ok I'll do that. |
Describe the bug
polyFill
function is not exported fromTyped.js
, but called at the top-level ofTyped.js
itself. This seems to cause issues with bundling, where the definition isn't picked up by the bundle, causing the top-levelpolyFill()
call to reportUncaught ReferenceError: polyFill is not defined
.To Reproduce
Initialize a spago project via
spago init
. Add the following list of dependencies tospago.dhall
:Modify
src/Main.purs
to be as follows:Bundle it and run it via
node
:Expected behavior
See the output:
"hello"
.Actual behavior
Additional context
Running the bundle through browser or node does not make a difference, failing in both cases.
The text was updated successfully, but these errors were encountered: