Skip to content

Warning about preload not used because of script type mismatch #45

Answered by ElMassimo
allan-farrell asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Allan!

Preload tags can be disabled by passing skip_preload_tags: true to the vite_javascript_tag helper. However, it seems like you are running into a different scenario.

Rails generates early preload hints incorrectly for type="module" scripts (uses rel=preload instead of rel=modulepreload).

I made a pull request to Rails fixing this, and it has been merged, but I'm not sure whether fixes are backported.

To disable that warning, you could:

  • Upgrade to a version that includes this patch (not released yet)
  • Patch javascript_include_tag manually to include the fix (not ideal)
  • Disable early hints in development/production: config.action_view.preload_links_header = false

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ElMassimo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants