Skip to content

Conversation

jbrantly
Copy link
Member

There was a discrepancy between the test runner and behavior when running webpack from the command line - if the previous bundle had the same hash as the current bundle in watch mode, webpack on the command line does not output any information (almost like nothing happened) whereas in the test runner we continued to operate as if something had been output. The first commit fixes that discrepancy.

Secondly, a change was made so that if a definition file is changed the hash for the compilation is also changed so that webpack does indeed output something to the screen. This reverts the changes to the declarationWatch test made in #100 and fixes #109.

Lastly, since the hashes have changed (and since hashes will now be different based on what your environment is since file paths are now included in the hashed data) the test runner has been updated to replace any hash in webpack output with [hash]. This allows the tests to run in any environment without issue.

cc @blakeembrey

… the hashes between two builds in watch mode match, no output is written.
…This way the hash for each module takes into account the definition files.
index.ts Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/\.d\.ts$/.test(filePath)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change

@blakeembrey
Copy link
Member

I think it's ok, mind explaining the this._module for me quickly (maybe again)?

@jbrantly
Copy link
Member Author

Sure. this._module is the object that webpack uses to store info about the module (errors, etc). Most of the loader API operates on it under the hood (eg, addDependency, etc). In any case, there is a "meta" property that participates in the hash generation for the module. I use (abuse?) it here to make sure that webpack thinks the module is "new" (even though the actual output didn't change).

jbrantly added a commit that referenced this pull request Nov 25, 2015
Fix watching of definition files
@jbrantly jbrantly merged commit 2553aed into master Nov 25, 2015
@jbrantly
Copy link
Member Author

Updated based on code review, merging. Thanks!

@johnnyreilly johnnyreilly deleted the issue-109 branch July 13, 2017 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is ts-loader adding d.ts files as a dependency to the bundle?

2 participants