Skip to content

Commit 1cc576d

Browse files
authored
Merge pull request #822 from JonWallsten/fix-declaration-output-wrong-folder
Fixed issue with incorrect output path for declaration files
2 parents d8096aa + 4b087a9 commit 1cc576d

File tree

9 files changed

+15
-8
lines changed

9 files changed

+15
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 5.0.0
4+
5+
* [feat: Fixed issue with incorrect output path for declaration files](https://github.com/TypeStrong/ts-loader/pull/822) - thanks @JonWallsten! **BREAKING CHANGE**
6+
37
## 4.5.0
48

59
* [feat: Added support for TypeScript declaration map](https://github.com/TypeStrong/ts-loader/pull/821) - thanks @JonWallsten!

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ts-loader",
3-
"version": "4.5.0",
3+
"version": "5.0.0",
44
"description": "TypeScript loader for webpack",
55
"main": "index.js",
66
"types": "dist/types/index.d.ts",

src/after-compile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ function provideDeclarationFilesToWebpack(
251251

252252
declarationFiles.forEach(declarationFile => {
253253
const assetPath = path.relative(
254-
compilation.compiler.context,
254+
compilation.compiler.outputPath,
255255
declarationFile.name
256256
);
257257
compilation.assets[assetPath] = {

src/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ export interface WebpackCompilation {
149149
export interface WebpackCompiler {
150150
isChild(): boolean;
151151
context: string; // a guess
152+
outputPath: string;
152153
watchFileSystem: WebpackNodeWatchFileSystem;
153154
/** key is filepath and value is Date as a number */
154155
fileTimestamps: Map<string, number>;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3-
"declaration": true
3+
"declaration": true,
4+
"declarationDir": ".output"
45
}
56
}

test/comparison-tests/declarationOutputWithMaps/expectedOutput-3.0/app.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/comparison-tests/declarationOutputWithMaps/expectedOutput-3.0/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Asset Size Chunks Chunk Names
22
bundle.js 5.13 KiB main [emitted] main
3-
app.d.ts.map 194 bytes [emitted]
3+
app.d.ts.map 197 bytes [emitted]
44
app.d.ts 143 bytes [emitted]
5-
sub/dep.d.ts.map 142 bytes [emitted]
5+
sub/dep.d.ts.map 152 bytes [emitted]
66
sub/dep.d.ts 96 bytes [emitted]
77
Entrypoint main = bundle.js
88
[./app.ts] 910 bytes {main} [built]

test/comparison-tests/declarationOutputWithMaps/expectedOutput-3.0/sub/dep.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
33
"declaration": true,
4-
"declarationMap": true
4+
"declarationMap": true,
5+
"declarationDir": ".output"
56
}
67
}

0 commit comments

Comments
 (0)