pika-pack-builders icon indicating copy to clipboard operation
pika-pack-builders copied to clipboard

[@pika/plugin-build-types] dist-types are not build with incremental tsconfig

Open vadistic opened this issue 4 years ago • 0 comments

Hello,

Issue:

Using @pika/plugin-build-types dist-types is not generated if incremental setting is true and *.tsBuildInfo file is present.

This results in easy to miss problem - I've found out about this after I've published package without typings :)

Right now there are two options:

// package.json
 // disable incremental in plugin options
      ...
      [
        "@pika/plugin-build-types",
        {
          "tsconfig": "./tsconfig.build.json",
          "args": ["--incremental", "false"]
        }
      ],
     ...
// tsconfig.build.json
// disable incremental in tsconfig.build.json
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "incremental": false
  },
}

Which is quite fine if you know about it, but I think @pika/pack is about being noconfig/user-friendly and it could be improved by eliminating this issue.

Proposals about how to address it:

  1. Forcefully override incremental setting (by adding additional flag to tsc in exaca)
  • it provides sane default
  • it still allows user to override this setting in "args" option because tsc -p tsconfig.build.json --incremental true --incremental false works as expected with tsc compiler
  • add info about this to readme
  1. Read tsconfig and emit warning if incremental option is set true
  • less invasive, self documenting
  • can be also easily implemented because plugin resolves tsconfig path

I would suggest approach 1.

It's a 10 minute PR, but I would like to know if anoyone else share my opinion on this and which of the two proposed approaches (or maybe some other one?) would be more in line with this project philosophy :smile:

vadistic avatar Apr 07 '20 18:04 vadistic