Skip to content

Commit

Permalink
Rolled back re-exported const enums no longer break emit in watch mod…
Browse files Browse the repository at this point in the history
…e as performance cost was too high - resolves #393
  • Loading branch information
johnnyreilly committed Dec 8, 2016
1 parent c55cec3 commit 47ec74d
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.3.1

- [Rolled back re-exported const enums no longer break emit in watch mode as performance cost was too high](https://github.com/TypeStrong/ts-loader/pull/406) resolves #393

## v1.3.0

- [Introduce meaningful error when importing TypeScript from `node_modules`](https://github.com/TypeStrong/ts-loader/pull/399)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-loader",
"version": "1.3.0",
"version": "1.3.1",
"description": "TypeScript loader for webpack",
"main": "index.js",
"scripts": {
Expand Down
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,17 @@ function getEmit(
const allDefinitionFiles = Object.keys(instance.files).filter(fp => definitionFileRegex.test(fp));
allDefinitionFiles.forEach(loader.addDependency.bind(loader));

/* - alternative approach to the below which is more correct but has a heavy performance cost
see https://github.com/TypeStrong/ts-loader/issues/393
with this approach constEnumReExportWatch test will pass; without it, not.
// Additionally make this file dependent on all imported files as well
// as any deeper recursive dependencies
let additionalDependencies = utils.collectAllDependencies(instance.dependencyGraph, filePath);
const additionalDependencies = utils.collectAllDependencies(instance.dependencyGraph, filePath);
*/

// Additionally make this file dependent on all imported files
const additionalDependencies = instance.dependencyGraph[filePath];
if (additionalDependencies) {
additionalDependencies.forEach(loader.addDependency.bind(loader));
}
Expand Down
3 changes: 3 additions & 0 deletions test/comparison-tests/constEnumReExportWatch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This test has been disabled as the extra correctness required for it to pass comes at the cost of too much performance loss.

https://github.com/TypeStrong/ts-loader/issues/393
Empty file.
2 changes: 1 addition & 1 deletion test/comparison-tests/instance/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"compilerOptions": {
},
"files": [
"a.ts"
"i-dont-exist"
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Asset Size Chunks Chunk Names
bundle.js 1.75 kB 0 [emitted] main
chunk {0} bundle.js (main) 197 bytes [rendered]
[0] ./.test/simpleDependency/app.ts 51 bytes {0} [built] [1 error]
[0] ./.test/simpleDependency/app.ts 51 bytes {0} [1 error]
[1] ./.test/simpleDependency/dep.ts 70 bytes {0} [built]
[2] ./.test/simpleDependency/deeperDep.ts 76 bytes {0} [built]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Asset Size Chunks Chunk Names
bundle.js 1.75 kB 0 [emitted] main
chunk {0} bundle.js (main) 197 bytes [rendered]
[0] ./.test/simpleDependency/app.ts 51 bytes {0} [built]
[0] ./.test/simpleDependency/app.ts 51 bytes {0}
[1] ./.test/simpleDependency/dep.ts 70 bytes {0} [built]
[2] ./.test/simpleDependency/deeperDep.ts 76 bytes {0} [built]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Asset Size Chunks Chunk Names
bundle.js 1.75 kB 0 [emitted] main
chunk {0} bundle.js (main) 197 bytes [rendered]
[0] ./.test/simpleDependency/app.ts 51 bytes {0} [built] [1 error]
[0] ./.test/simpleDependency/app.ts 51 bytes {0} [1 error]
[1] ./.test/simpleDependency/dep.ts 70 bytes {0} [built]
[2] ./.test/simpleDependency/deeperDep.ts 76 bytes {0} [built]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Asset Size Chunks Chunk Names
bundle.js 1.75 kB 0 [emitted] main
chunk {0} bundle.js (main) 197 bytes [rendered]
[0] ./.test/simpleDependency/app.ts 51 bytes {0} [built]
[0] ./.test/simpleDependency/app.ts 51 bytes {0}
[1] ./.test/simpleDependency/dep.ts 70 bytes {0} [built]
[2] ./.test/simpleDependency/deeperDep.ts 76 bytes {0} [built]

0 comments on commit 47ec74d

Please sign in to comment.