Skip to content

Typescript compile errors don't cause build failure #182

@rsheasby

Description

@rsheasby

Describe the bug
When using svelte-preprocess for typescript, a TS compilation error does not abort the build, and results in the bundle still being created, as well as a successful status code being returned.

This is especially a problem for verifying that something builds correctly in CI scripts.

Logs
You can see an example here with a syntax error in a typescript style tag:

rsheasby@Ryan-Mac ~/D/b/client (6-registration-email)> npx rollup -c

src/main.js → public/build/bundle.js...
src/App.svelte:7:14 - error TS1005: '=' expected.

7 import Bulma ;from './Bulma.svelte';
~
src/App.svelte:7:15 - error TS2304: Cannot find name 'from'.

7 import Bulma ;from './Bulma.svelte';
~~~~
src/App.svelte:7:20 - error TS1005: ';' expected.

7 import Bulma ;from './Bulma.svelte';
~~~~~~~~~~~~~~~~

created public/build/bundle.js in 8s
rsheasby@Ryan-Mac ~/D/b/client (6-registration-email)> echo $status
0

As you can see, the bundle is still written and the status code is 0.
When doing the same build with a javascript style tag(thereby removing the preprocess step), the build fails and returns status code 1 as expected.

To Reproduce
Setup boilerplate svelte with rollup, add svelte-preprocess for typescript, and add a syntax error to a typescript script tag.

Expected behavior
Rollup should fail and return a bad status code when a preprocessor fails

Information about your project:
Examples provided from macOS Catalina with rollup v2.16.11 and svelte-preprocess v3.9.7.
Has been confirmed on various Linux systems too.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions