parcel-bundler/parcel

Compile to js doesn't modify script type=application/ts to type=application/javascript

Open

#2267 opened on Nov 9, 2018

View on GitHub
 (3 comments) (0 reactions) (0 assignees)JavaScript (44,030 stars) (2,274 forks)batch import
:bug: Bug:heavy_check_mark: Confirmed BugGood First Issue

Description

🐛 bug report

Out of the box, the compilation to js of some ... works but in the resulting html the type attribute is kept intact (application/ts) and the browser (firefox in my case) doesn't execute the produced javascript

🎛 Configuration (.babelrc, package.json, cli command)

yarn global add parcel-bundler
yarn init -y
{
  "name": "compile-to-js",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "devDependencies": {
    "typescript": "^3.1.6"
  }
}

🤔 Expected Behavior

The produced html should contain type="application/javascript"

😯 Current Behavior

The produced html contains type="application/ts"

💻 Code Sample

index.html:

<!doctype html>
<html>
    <body>
        <script type="application/ts">
            type TT = "bouh" | "bar"
            function log(t: TT){
                console.log(t)
            }
            log("bouh")
        </script>
    </body>
</html>

parcel index.html

Result:

<!doctype html>
<html>
    <body>
        <script type="application/ts">function log(t) {
  console.log(t);
}

log("bouh");</script>
    </body>
</html>

🌍 Your Environment

Software Version(s)
Parcel 1.10.3
Node v11.1.0
npm/Yarn 6.4.1/1.9.4
Operating System OSX

Contributor guide