ionic-team / stencil

A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase.
https://stenciljs.com
Other
12.55k stars 784 forks source link

Bug: Stencil Build not throws type errors for first time #4355

Closed Manipandian closed 1 year ago

Manipandian commented 1 year ago

Prerequisites

Stencil Version

3.2.1

Current Behavior

When i try to run "stencil build" command with some new type errors in component code, It is not reporting those errors and generating build successfully. But if i run the same command again, this time i can get that error. I thought it is happening, because first time we dont have component.d.ts. But with that file also i can able to reproduce the issue by creating new type error in component and triggering build command(If i trigger build second time without any change, i can get that error now). I have analysed component.d.ts, it is getting updated with new type details on first build itself.

Expected Behavior

While running Stencil Build command with type error on code, We should get type errors on first time itself.

System Info

Node Version: 16

Steps to Reproduce

  1. Create a new Stencil project for component using CLI or use existing stencil project.
  2. Create any type error inside component (eg. @Prop() disableYear: number = false; )
  3. Now Run "stencil build " command( Dont use --watch). Build will get succeed without any type error. If you trigger "stencil build" command again, this time you will get the error.

Code Reproduction URL

https://github.com/ionic-team/stencil-component-starter

Additional Information

Note: I have analysed Stencil source code, You have some condition to check whether component.d.ts file got any changes after transpile or not. Whenever that condition return true, It is ignoring type validation error and proceeding with build generation(~/src/compiler/types/generate-app-types.ts). I found it through you debug log only(config.logger.debug(generateAppTypes: ${componentsDtsRelFileName} has changed))

tanner-reits commented 1 year ago

@Manipandian Thanks for reporting this issue! I was able to confirm the inconsistency of build errors when running stencil build if a src/components.d.ts file does not exist or is not updated with the latest component metadata (props, events, etc.). I'll get this issue labeled and ingested into our backlog for the team to take a look at!

Thanks again and hope you're enjoying Stencil!

Manipandian commented 1 year ago

@tanner-reits , Thanks for immediate response. Is there any workaround to get through this issue?, For now every-time we are triggering stencil build two times to overcome this issue. But that will affect our build time, because of huge code base in long run.

tanner-reits commented 1 year ago

Closing as a duplicate of #3534

This is still an issue the team will address. However, all future updates will be tracked in the linked issue.