Parcel: ๐Ÿ› Not displaying or honoring Typescript errors

Created on 1 Jan 2018  ยท  8Comments  ยท  Source: parcel-bundler/parcel

Using a minimal typescript project, parcel will not display errors that typescript catches.

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

Babel is not used in the example I gave but could be easily put in.

๐Ÿค” Expected Behavior

parcel should display errors caught by typescript in two places.

  1. In the CLI
  2. On the web page, either as an overlay or in the console

Also, parcel should honor noEmitOnError in tsconfig.json and not output compiled code if an error is found when running parcel build

๐Ÿ˜ฏ Current Behavior

No errors are displayed and the project builds even when noEmitOnError is set to true

๐Ÿ”ฆ Context

I have been trying to integrate parcel with a medium size typescript project I have, however it swallows typescript errors.

๐Ÿ’ป Code Sample

https://github.com/kaw2k/parcel-typescript-errors

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | v1.4.1
| Node | v8.2.1
| npm/Yarn | Yarn
| Operating System | OSX High Sierra

Feature TypeScript

Most helpful comment

Why closing this request?

Ignoring errors defeats the puprose of using TypeScript. Thus the advertised TypeScript "support" is misleading.

All 8 comments

I think this will work if u use the full typescript support plugin https://github.com/fathyb/parcel-plugin-typescript
This should however still get into the core eventually i guess

@DeMoorJasper that plugin still emits on error, I filed an issue: https://github.com/fathyb/parcel-plugin-typescript/issues/9

Edit: this issue is now fixed and the plugin does not emit using noEmitOnError.

It's really unfortunate to have grave bugs (this bug in Parcel itself and fathyb/parcel-plugin-typescript#59 ) which make Parcel unusable for TypeScript projects.

The parcel-plugin-typescript seems to be completely broken. It doesn't just fail to report any type errors, but it also breaks parcel build. When I install this plugin, I start getting this error:

image

Why closing this request?

Ignoring errors defeats the puprose of using TypeScript. Thus the advertised TypeScript "support" is misleading.

@fathyb is the plugin author
I hope Parcel 2 will have better Typescript support.

FYI, this issue is now getting tracked as part of #1378

If it helps anyone else, this is the workaround I came up with after reading through this issue and all the other ones related to Typescript support trying to find a solution.

Use the concurrently package (npm i -D concurrently) and then in package.json:

"scripts": {
   "dev": "concurrently --kill-others \"npm:compile:watch\" \"npm:dev:server\"",
   "dev:server": "parcel ./src/index.html --https --out-dir artifacts/obj",
   "compile:watch": "tsc -p . --noEmit --watch",
}

Then npm run dev will output something like:

01:20:35 - File change detected. Starting incremental compilation...
[compile:watch] 01:20:35 - Found 0 errors. Watching for file changes.
[dev:server] โˆš  Built in 605ms.

01:20:55 - File change detected. Starting incremental compilation...
[dev:server] โˆš  Built in 637ms.
[compile:watch] src/components/AppRoot.tsx(69,14): error TS2304: Cannot find name 'Counter'.
[compile:watch] 01:20:55 - Found 1 error. Watching for file changes.

It doesn't fail the Parcel build, but I personally don't care as it only takes a few hundred milliseconds.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dsky1990 picture dsky1990  ยท  3Comments

oliger picture oliger  ยท  3Comments

philipodev picture philipodev  ยท  3Comments

davidnagli picture davidnagli  ยท  3Comments

dotdash picture dotdash  ยท  3Comments