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

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

@OliverJAsh

Description

@OliverJAsh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions