Skip to main content

parcel-bundlerCLI Dev tool to run TS in Browser

install parcel-bundler tool for TS

npm i -g parcel-bundler

Parcel can auto-detect .ts files inside index.html, then compile and replace with JS

add type attribute of module to script tags

<script type="module" src="./src/index.ts"\>

Else parcel throws error:

@parcel/transformer-js: Browser scripts cannot have imports or exports.

!bug - fails to run with node v18.2.0

!bug - really slow to compile

References