Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

258
Visualizações
Blazor Server Side MIME type error for content JS file

I've create a base assembly BaseDll that compiles as a referenced project by my main Blazor Server Side MainBSSApp.

The base assembly contains a few JS functions that are located in the myJSFile.js file of the BaseDll assembly (I've added them into a BaseDll.wwwroot folder).

So I add the reference to my JS file in MainBSSApp/Shared/_Host.cshtml (I actually tried several places, result is always the same - I now have it in the <head> section):

<script src="_content/BaseDll/myJSFile.js"></script>

When I execute the MainBSSApp on my standard VS version (Windows) all seems to work fine. Now I'm trying to migrate the project on Ubuntu with VS Code. Views referenced by BaseDll as well as services are working fine. However, as soon as I call any JS method defined in the myJSFile.js, I do get an error because the function is not defined - and righ before that, I get the warning that `The scritp from "[...]/_content/BaseDll/myJSFile.js" was loaded even though its MIME type ("text/html") is not a valid JavaScript MIME type."

So I tried this fix but without luck (I tried both 777 and 705 permission, nothing changed)...

What am I doing wrong here?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Solution is indeed to add the ./ before the _content

<script src="./_content/BaseDll/myJSFile.js"></script>

credits to @pcalkins and to the docs...

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda