Skip to content
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

Empty page with "SyntaxError: expected expression, got '.'" on Firefox 60esr and Chromium 73 #230

Closed
Lomanic opened this issue Feb 13, 2021 · 5 comments · Fixed by #548
Closed
Labels
bug Something isn't working

Comments

@Lomanic
Copy link

Lomanic commented Feb 13, 2021

Describe the bug
Hydrogen is broken on Firefox 60esr and all versions before 74 and Chromium 73 and all versions before 80, the page is only blank.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://hydrogen.element.io/ with Firefox 60esr (any version before 74, see below) or Chromium 73 (any version before 80, see below)
  2. You are only greeted with an empty blank page
  3. In the web console, the following error is raised
    SyntaxError: expected expression, got '.' 
    hydrogen-1718798642.js:131:13
    

Expected behavior
Page is properly displayed without issue

Desktop:

  • OS: GNU/Linux Debian 9.13 x64
  • Browser Firefox
  • Version 60.9.0esr (64 bits)

Desktop:

  • OS: GNU/Linux Debian 9.13 x64
  • Browser Chromium
  • Version 73.0.3683.75 (64 bits)

Additional context
Identical issue as matrix-org/matrix.to#193 (fixed in matrix-org/matrix.to@a464254 that I tried to apply without success) but for Hydrogen, the same applies here.

@bwindels
Copy link
Contributor

Thanks for reporting. This is because the build system assumes that anything that supports ES modules will support modern js syntax like ?. (what somewhat older browsers choke on). Need to fix this by better feature detection ...

@bwindels bwindels added the bug Something isn't working label Feb 15, 2021
@bwindels
Copy link
Contributor

bwindels commented Feb 15, 2021

Actually, we should compile down to only features supported by whatever version supports es modules for each browser. E.g. async functions and classes are supported everywhere ES modules are supported, so they don't need to be compiled down. Optional chaining is not, so it should be transpiled down in the ES6 bundle.

@bwindels
Copy link
Contributor

bwindels commented Dec 8, 2021

After some testing, the build created with vite loads in Chrome 73 but not in Firefox 61 because it seems to choke on this regex with the error SyntaxError: invalid regexp group. https://stackoverflow.com/questions/59488172/firefox-regex-syntaxerror-invalid-regexp-group and https://caniuse.com/js-regexp-lookbehind seem to explain this and I can confirm that the page does indeed load in Firefox 78. We should probably not use lookbehind.

@bwindels
Copy link
Contributor

bwindels commented Dec 8, 2021

After replacing the lookbehind I was able to load the app in Firefox 63, well before Firefox 78 (can only do limited testing through test account on browserstack)

@bwindels
Copy link
Contributor

bwindels commented Dec 8, 2021

The service-worker seems to fail to load on older browsers though, for the same reason as before (it is not transpiled and we use ?.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants