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

Strict MIME type checking error with workbox #217

Closed
tacman opened this issue Jun 6, 2024 · 3 comments
Closed

Strict MIME type checking error with workbox #217

tacman opened this issue Jun 6, 2024 · 3 comments

Comments

@tacman
Copy link
Contributor

tacman commented Jun 6, 2024

Version(s) affected

1.2

Description

I get the following error on production but not in dev

failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/octet-stream". Strict MIME type checking is enforced for module scripts per HTML spec.

How to reproduce

Look at the console log in https://noise.survos.com/

Repo is at https://github.com/survos-sites/noise, but running in dev it works okay, and it even works okay running in prod locally.

Possible Solution

The error is here:

<script type="module" >
  import {Workbox} from '/workbox/workbox-window.prod.mjs';
  if ('serviceWorker' in navigator) {
    const wb = new Workbox('/sw.js', {scope: '/', useCache: true});
    wb.register();
    window.workbox = wb;
  }
</script>

Perhaps related to skip_waiting?

Additional Context

This was the first project I did with pwa-bundle, from 1.0, so it's possible that pwa.yaml isn't configured to 1.2 standards.

image

@Spomky
Copy link
Member

Spomky commented Jun 6, 2024

Hi,

I got a similar issue in the past with nginx.
This can be fixed from the server config. See storybookjs/storybook#20157 (comment) for example.

@tacman
Copy link
Contributor Author

tacman commented Jun 6, 2024

Indeed, that worked, thanks!

I wonder if the docs could have a section called "Troubleshooting" which included these kind of issues.

@tacman tacman closed this as completed Jun 6, 2024
Copy link

github-actions bot commented Jul 8, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants