Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Non-deterministic build output when used with ts-loader #261

Open
OliverJAsh opened this issue Jun 25, 2020 · 0 comments
Open

Non-deterministic build output when used with ts-loader #261

OliverJAsh opened this issue Jun 25, 2020 · 0 comments

Comments

@OliverJAsh
Copy link

OliverJAsh commented Jun 25, 2020

I am using HappyPack in combination with ts-loader. When I use webpack in watch mode, I noticed that webpack may produce different results between the first build and the second build (triggered by watch mode when a file is saved/changed).

This was very surprising to me, so I created a reduced test case: https://github.com/OliverJAsh/webpack-happypack-ts-loader-bug

In the README.md I have outlined some steps to reproduce this behaviour.

It seems the reason for this is that ts-loader is picking a using config file in the second build.

Immediately before the first build we see this logged:

ts-loader: Using typescript@3.9.3 and /Users/oliverash/Development/webpack-happypack-ts-loader-bug/tsconfig.json

Immediately before the second build we see this logged:

ts-loader: Using typescript@3.9.3 and /Users/oliverash/Development/webpack-happypack-ts-loader-bug/shared/tsconfig.json

Notice how the tsconfig.json path is different!

ts-loader is supposed to derive the tsconfig.json path from the "entry file", but in the second build it seems to be deriving it from the file which changed (which isn't an entry point).

At first I thought this was an issue with ts-loader, but I can only reproduce this when I'm also using HappyPack.

In case it helps others, I am able to workaround it by specifying an explicit configFile in the ts-loader options.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant