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

Problem loading Sveltekit modules on Tizen 6 #15

Open
chipndahla opened this issue Jan 24, 2024 · 4 comments
Open

Problem loading Sveltekit modules on Tizen 6 #15

chipndahla opened this issue Jan 24, 2024 · 4 comments

Comments

@chipndahla
Copy link

We're using TVkit to transpile our code to older Tizen models. This works very well in general so big thanks. But have an odd issue with Tizen 6 (M76) I use TVkit to transpile to Tizen 5 and that works for both Tizen 5 and Tizen 6.5, but oddly not on a Tizen 6. Also tried to target Tizen 6 with Tvkit but still no success.

In the console I get many of these errors while loading different javascript files:

"Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec."

Any ideas why?

@bfanger
Copy link
Owner

bfanger commented Jan 24, 2024

I don't have access to a Tizen 6 device, so i'm speculating here:

  • The (internal) webserver doesn't use the correct mimetype
  • The browser engine supports modules, but maybe samsung borked it in some way.

Try if a hosted works or if adding --add "es6-module" to tvkit fixes it.

@chipndahla
Copy link
Author

chipndahla commented Jan 25, 2024

Did some more investigations.

First, to my best knowledge the Tizen TV doesn't have an internal webserver, instead it accesses the assets through file:/// which is not normally allowed but Tizen launches Chromium with --allow-file-access-from-files (and a number of other special parameters)

Example how Tizen loads a file (notice the file:///)
image

Since no webserver can set the MIME types, at least in M76, Chromium refuses to load the JS modules. Will try to verify now

And already uses --add "es6-module" as per a previous chat (a very useful feature! thanks!)

@chipndahla
Copy link
Author

Update I installed old Chrome versions om my dev machine and started it with same params as Tizen does. Could repeat the results!

On M63 (Tizen 5) file:/// are loaded but no MIME type is assigned but no strict MIME-type is required either.

On M76 (Tizen 6) js files are loaded in the same way but console shows lots of MIME warnings:
image
Console:
image

On a modern M120 MIME-types headers seem to be automatically added:
image

So this is clearly an issue with chrome versions around M76.

Will now see if I can work around the issue by assigning MIME-types in javascript

@chipndahla
Copy link
Author

chipndahla commented Jan 25, 2024

Have now experimented further and despite all the console errors my application seem to work fine (the original errors I had instead seem to come from a Firestore issue on Tizen). Still seem very odd to me that to show a
image

and then anyhow seem to load the module.

One possible work around would be to either set the MIME-type manually while importing them. Is that possible in Rollup or Babel? Alternatively storing them online and then get the expected MIME-headers from the server.

Any ideas? And thanks for taking the time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants