-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Bug: Compiled dist/mdc.drawer.js file drops ternary expression from tabbable package, giving SSRed apps "ReferenceError: Element is not defined" #4104
Comments
Thanks for reporting this issue 4cm4k1@! I'm able to reproduce this issue, seems like the So here is the dependency graph with their versions: I just sent a PR on |
Cool! Thanks @abhiomkar! |
Oh, I just noticed and thought I should also point out that this issue will occur with Also, if this helps, I think @moog16 changed |
@4cm4k1 I think you are right in that we won't need to get focus-trap/focus-trap#69 merged upstream in However as it currently stands it seems that the issue originates in relevant stack trace:
I just pinged |
Based on focus-trap/focus-trap#73 it seems that So all that remains to be done is to bump the |
Great news! Looking forward to it. |
What MDC Web Version are you using?
v0.41.1 via MDC Web React v0.7.0
What browser(s) is this bug affecting?
N/A
What OS are you using?
macOS 10.14.2
What are the steps to reproduce the bug?
@material/drawer@^0.41.0
in a server-side rendered app.What is the expected behavior?
The code in
dist/mdc.drawer.js
should have the same ternary expression as found in the tabbable package here: https://github.com/davidtheclark/tabbable/blob/master/index.js#L14. It checks iftypeof Element
is undefined, as it would be outside of the browser (eg, on Node).(The maintainer of tabbable introduced this logic in v3.1.1 with this PR: focus-trap/tabbable#33)
What is the actual behavior?
What is actually in
dist/mdc.drawer.js
at line 809 removes the ternary expression as follows:This causes an error on the server side, as follows:
Any other information you believe would be useful?
I suspect this has to do with the configuration of bundling everything together as UMD modules in this PR (#3245), which changed the "main" entry for packages to
dist/*.js
. That is, something in the bundling process is thinking it can save some LOC by eliminating code that isn't relevant to a browser target?Also #929.
The text was updated successfully, but these errors were encountered: