Closed pelikhan closed 3 years ago
ReferenceError: self is not defined
at .....\browser-fs-access\dist\supported.mjs:2:15
I have asked for help from some bundler experts internally at Google and hope to get back with an answer. Thanks for your patience.
Gating with typeof self !== “undefined” should do it. Same for window.
From: Thomas Steiner @.> Sent: Thursday, July 1, 2021 11:02:10 AM To: GoogleChromeLabs/browser-fs-access @.> Cc: Peli de Halleux @.>; Author @.> Subject: Re: [GoogleChromeLabs/browser-fs-access] SSR support (#54)
I have asked for help from some bundler experts internally at Google and hope to get back with an answer. Thanks for your patience.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FGoogleChromeLabs%2Fbrowser-fs-access%2Fissues%2F54%23issuecomment-872064075&data=04%7C01%7Cjhalleux%40microsoft.com%7Cf5ba9cb17f00409bfbc008d93c6ee95e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637607269329832210%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=RQuNENb9pGYBfX57%2B6lnXxnoVjwYnT2Ki8ovSqKceN8%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAA73QKJZARXHNBMX3BHY7FTTVQVJFANCNFSM47SQGGCA&data=04%7C01%7Cjhalleux%40microsoft.com%7Cf5ba9cb17f00409bfbc008d93c6ee95e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637607269329832210%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=mwDfwm%2BOGBleRYuOCR1PlD%2Fhvc%2FKlYWPgV2kJzoh6Zg%3D&reserved=0.
Oh, I see, if this would work for you, then it's an easy fix.
Untested but this is how one guards against any global object that is not available outside the browser.
From: Thomas Steiner @.> Sent: Thursday, July 1, 2021 11:18:21 AM To: GoogleChromeLabs/browser-fs-access @.> Cc: Peli de Halleux @.>; Author @.> Subject: Re: [GoogleChromeLabs/browser-fs-access] SSR support (#54)
Oh, I see, if this would work for you, then it's an easy fix.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FGoogleChromeLabs%2Fbrowser-fs-access%2Fissues%2F54%23issuecomment-872077406&data=04%7C01%7Cjhalleux%40microsoft.com%7C81a9b0d171114f39525e08d93c712c26%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637607279040997137%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2E%2FbvJvMrjsSDqpJ8w6mc6c2ovdkJ6OfUyDaP%2Bsoaq0%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAA73QKKUITGWFEPFLWOSKHDTVQXF3ANCNFSM47SQGGCA&data=04%7C01%7Cjhalleux%40microsoft.com%7C81a9b0d171114f39525e08d93c712c26%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637607279041007132%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=FVYxH8wAhvoWnRG3nwLOc1xY4ta5MkaOF36RSq4LDoE%3D&reserved=0.
When using this library with a server-side-rendering module, it fails to load in webpack because of references to "self".