# Mime type error when attempting to load ts/js into hugo

**URL:** <https://discourse.gohugo.io/t/mime-type-error-when-attempting-to-load-ts-js-into-hugo/25186>\
**Category:** support\
**Created:** [May 1, 2020, 11:41am UTC](https://discourse.gohugo.io/t/mime-type-error-when-attempting-to-load-ts-js-into-hugo/25186 "2020-05-01T11:41:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ealmz](https://avatars.discourse-cdn.com/v4/letter/e/6de8d8/32.png) [@ealmz](https://discourse.gohugo.io/u/ealmz)\
**Post date:** [May 1, 2020, 11:41am UTC](https://discourse.gohugo.io/t/mime-type-error-when-attempting-to-load-ts-js-into-hugo/25186/1 "2020-05-01T11:41:56Z")

</div>

Hi all, I loaded ts/js into my hugo template but I’m stuck on this error:

`localhost/:1 Refused to execute script from 'http://localhost:1313/js/public.min.96c0ed8357c9dddb780bbc4aff81e7fde27919c5b644b2e5ac344d3307bd08ef.ts' because its MIME type ('video/mp2t') is not executable.`

The file that is linked is this:

```auto
import "../sass/branches/index.scss";
import NavMarketing from "./utils/nav_marketing";

// Bind events that happen on DOM Load
document.addEventListener("DOMContentLoaded", () => {
  NavMarketing.init();
});

```

It seems other people have run into this issue and solved it specifically for Angular. I didn’t find any solutions that were relevant. Any pointers in the right direction are appreciated. 🙌

### Additional info

This is what my scripts partial looks like, in case that is relevant:

```auto
{{ $script := resources.Get "js/public.ts" | resources.Minify | resources.Fingerprint }}
<script type="text/javascript" src="{{ $script.Permalink }}"></script>

```

---

<div class="post-metadata">

**Author:** ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)\
**Post date:** [May 1, 2020, 12:20pm UTC](https://discourse.gohugo.io/t/mime-type-error-when-attempting-to-load-ts-js-into-hugo/25186/2 "2020-05-01T12:20:17Z")

</div>

> [@ealmz](#):
>
> ef.ts’ because its MIME type (‘video/mp2t’)

error comes from the extension **.ts** (where it comes from??)  
add `type="text/css"` to the link

my version looks like (without SCSS)

```
{{ $mccs := resources.Get "css/main.css" }}
{{ if hugo.IsProduction }} {{ $mccs = $mccs | minify | resources.Fingerprint site.Params.digest }} {{end}}
<link type=text/css rel=stylesheet href={{ $mccs.RelPermalink }} {{ if hugo.IsProduction }} integrity={{ $mccs.Data.Integrity }} {{end}} media="screen, print" />

```

if you use fingerprinting, add the integrity option!

---

<div class="post-metadata">

**Author:** ![ealmz](https://avatars.discourse-cdn.com/v4/letter/e/6de8d8/32.png) [@ealmz](https://discourse.gohugo.io/u/ealmz)\
**Post date:** [May 1, 2020, 5:52pm UTC](https://discourse.gohugo.io/t/mime-type-error-when-attempting-to-load-ts-js-into-hugo/25186/4 "2020-05-01T17:52:36Z")

</div>

I accidentally posted an incorrect CSS partial, I fixed my original post

---

<div class="post-metadata">

**Author:** ![ealmz](https://avatars.discourse-cdn.com/v4/letter/e/6de8d8/32.png) [@ealmz](https://discourse.gohugo.io/u/ealmz)\
**Post date:** [May 2, 2020, 4:35am UTC](https://discourse.gohugo.io/t/mime-type-error-when-attempting-to-load-ts-js-into-hugo/25186/5 "2020-05-02T04:35:47Z")

</div>

Bumping this up for reach 😬

---

<div class="post-metadata">

**Author:** ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)\
**Post date:** [May 2, 2020, 4:37am UTC](https://discourse.gohugo.io/t/mime-type-error-when-attempting-to-load-ts-js-into-hugo/25186/6 "2020-05-02T04:37:57Z")

</div>

Please have a read about [Requesting Help](https://discourse.gohugo.io/t/requesting-help/9132) to see how to help us help you more easily.

---

<div class="post-metadata">

**Author:** ![ealmz](https://avatars.discourse-cdn.com/v4/letter/e/6de8d8/32.png) [@ealmz](https://discourse.gohugo.io/u/ealmz)\
**Post date:** [May 2, 2020, 5:38am UTC](https://discourse.gohugo.io/t/mime-type-error-when-attempting-to-load-ts-js-into-hugo/25186/7 "2020-05-02T05:38:02Z")

</div>

Will replicate in a separate repo next time. Figured this one out. Basically the answer is you have to use webpack (which I thought hugo would take care of transpiling js automatically).
