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

Extension JS code may be blocked #54

Closed
vladmandic opened this issue Jun 28, 2023 · 2 comments
Closed

Extension JS code may be blocked #54

vladmandic opened this issue Jun 28, 2023 · 2 comments

Comments

@vladmandic
Copy link
Contributor

Depending on OS/browser settings, loading of extension js file extension.mjs may be blocked

[[Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.](extension.mjs:1)](http://localhost:7880/file=extensions-builtin/sd-webui-agent-scheduler/javascript/extension.mjs?1685812961.9794707)

This is a known issue already discussed in #4 and vladmandic/automatic#1506 and i feel this is going to happen more and more in the future. And while solution provided is fully viable and clean, its not reasonable to expect users to edit registry for normal functionality.

Normally I'd say that ES is preferred format for JS, but the issue here is that all JS files are served by gradio using generic /file= functionality, there is no way to set proper MIME type handling (ok, doable via custom fastapi middleware, but that may be going too far).

Suggestion is to modify vite.config.ts

  • change vite build target (build.lib.formats) from es to iife
  • change build destination file (build.lib.fileName') from extensiontoagent-scheduler`
    (current name is misleading to start with)
@artventuredev
Copy link
Contributor

Agreed, I already planed to do this since more and more people getting the issue. Btw I just update the format to iife, should be good now.

@vladmandic
Copy link
Contributor Author

thanks!

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