Erroneous "import declarations may only appear at top level of a module" for module service worker
Categories
(Core :: DOM: Service Workers, defect)
Tracking
()
People
(Reporter: alancutter, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.63 Safari/537.36
Steps to reproduce:
Register service worker as a module. Use an import statement at the top of the service worker.
Repro site: https://time-hickory.glitch.me/
Actual results:
Console errors:
SyntaxError: import declarations may only appear at top level of a module serviceworker.js:1
TypeError: ServiceWorker script at https://time-hickory.glitch.me/serviceworker.js for scope https://time-hickory.glitch.me/ encountered an error during installation.
Expected results:
Console should log success.
Comment 1•5 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Comment 2•5 years ago
|
||
(In reply to alancutter from comment #0)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.63 Safari/537.36
Steps to reproduce:
Register service worker as a module. Use an import statement at the top of the service worker.
Repro site: https://time-hickory.glitch.me/Actual results:
Console errors:
SyntaxError: import declarations may only appear at top level of a module serviceworker.js:1
TypeError: ServiceWorker script at https://time-hickory.glitch.me/serviceworker.js for scope https://time-hickory.glitch.me/ encountered an error during installation.Expected results:
Console should log success.
Hi allancutter, thank you for the bug report! I believe that module Service Workers are not yet implemented in Firefox; this is tracked by bug 1360870.
Description
•