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

[@pika/plugin-ts-standard-pkg] Handle "incremental: true"

Open oBusk opened this issue 6 years ago • 3 comments

There are problems when/if incremental: true in the used tsconfig.json.

  • The .tsbuildinfo is outputted into dist-src
  • If tsBuildInfoFile is set, incremental builds will fail with Error: "dist-src/" does not exist, or was not yet created in the pipeline.
    1. Set incremental: true and tsBuildInfoFile: '.cache/.tsbuildinfo'
    2. pack build should succeed
    3. Running pack build any time after will fail, until you delete .cache

I don't know if there is any gain in trying to support incremental: true or if the plugin should just console.error() or force the setting to false.

oBusk avatar Jul 13 '19 00:07 oBusk

This is a great idea, but unfortunately right now we clear the pkg/ directory every time we build. To solve we would need to either:

  1. allow plugins/users to configure whether the pkg/ directory is cleared on re-build
  2. create the "watch" mode that we've always talked about, and enable this here

I'm leaning towards # 2, at least since this isn't the first time that has been asked for

FredKSchott avatar Jul 15 '19 19:07 FredKSchott

@FredKSchott I'm not sure what "watch mode" would be for personally, but if people are asking for it, then yea, making use of the performance gain of incremental: true would be very nice. But since you can store the cache tsBuildInfoFile to any other directory, keeping pkg wouldn't necessarily be required. Like i wrote, the build seems to go through (no error), but no new file is outputed into pkg/dist-src.

oBusk avatar Jul 16 '19 13:07 oBusk

@FredKSchott So without knowing how any watch mode would work, the fix would either be to override the incremental setting in the builder, or alert the user to disable the setting.

Obviously overriding the setting would be the better solution, like this (https://github.com/oBusk/builders/commit/2e4dbf49f9f9e7842003de6bd2395d7f050912ed), but the problem with that, is that there is no way to "unset" the tsBuildInfoFile setting as a CLI argument, so if you've defined it in the tsconfig.json, you'll alwyas get a printed error;

error TS5069: Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or option 'composite'.

So the other option would be to add warning for it, so the user is aware why the build isn't working, would look something like this; https://github.com/oBusk/builders/commit/64b26dfcf8ab95c3ef28fef76069fce557a787ce

oBusk avatar Jul 16 '19 23:07 oBusk