purescript / trypurescript

PureScript in the browser
https://try.purescript.org
BSD 3-Clause "New" or "Revised" License
119 stars 50 forks source link

NPM dependency shims no longer work on Firefox 102.1? #289

Closed JordanMartinez closed 2 years ago

JordanMartinez commented 2 years ago

I think Firefox made a few changes recently (not exactly sure what) that breaks es-module-shims. Running the below code on https://try.purescript.org doesn't work for Firefox 102.1 but does on Chromium 103.0.5060.53. Can anyone else confirm?

module Main where

import Prelude

import Data.Foldable (fold)
import Effect (Effect)
import Effect.Console (log)
import TryPureScript as TP
import Data.Decimal as D

main :: Effect Unit
main = TP.render =<< TP.withConsole do
  log $ show $ D.fromString "132.4242"
JordanMartinez commented 2 years ago

The error I see in the console is: 2022-07-16_10-56

pete-murphy commented 2 years ago

Yeah, I get the following errors (on Firefox Dev Edition 100.0b9) with that snippet

Uncaught ReferenceError: main is not defined
    <anonymous> https://try.purescript.org/js/index.js:61
index.js:61:1
asm.js type error: Asm.js optimizer disabled because debugger is active es-module-shims.js
Uncaught (in promise) DOMException: Permission denied to access property "document" on cross-origin object es-module-shims.js:1
Uncaught TypeError: Error resolving module specifier “decimal.js”. Relative module specifiers must start with “./”, “../” or “/”. foreign.js:1:20
image

On Chrome 102.0.5005.115 I do see the (Just (fromString "132.4242")) rendered, and the

Uncaught ReferenceError: main is not defined
    at index.js:61:1

error in console.

JordanMartinez commented 2 years ago

Thanks!

Yeah, the ReferenceError: main is not defined was fixed in #288.

JordanMartinez commented 2 years ago

Looks like updating es-module-shims to 1.5.9 fixes the issue.