Skip to content

Commit

Permalink
Merge pull request #822 from JonWallsten/fix-declaration-output-wrong…
Browse files Browse the repository at this point in the history
…-folder

Fixed issue with incorrect output path for declaration files
  • Loading branch information
johnnyreilly committed Sep 3, 2018
2 parents d8096aa + 4b087a9 commit 1cc576d
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 5.0.0

* [feat: Fixed issue with incorrect output path for declaration files](https://github.com/TypeStrong/ts-loader/pull/822) - thanks @JonWallsten! **BREAKING CHANGE**

## 4.5.0

* [feat: Added support for TypeScript declaration map](https://github.com/TypeStrong/ts-loader/pull/821) - thanks @JonWallsten!
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": "4.5.0",
"version": "5.0.0",
"description": "TypeScript loader for webpack",
"main": "index.js",
"types": "dist/types/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/after-compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ function provideDeclarationFilesToWebpack(

declarationFiles.forEach(declarationFile => {
const assetPath = path.relative(
compilation.compiler.context,
compilation.compiler.outputPath,
declarationFile.name
);
compilation.assets[assetPath] = {
Expand Down
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export interface WebpackCompilation {
export interface WebpackCompiler {
isChild(): boolean;
context: string; // a guess
outputPath: string;
watchFileSystem: WebpackNodeWatchFileSystem;
/** key is filepath and value is Date as a number */
fileTimestamps: Map<string, number>;
Expand Down
3 changes: 2 additions & 1 deletion test/comparison-tests/declarationOutput/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"declaration": true
"declaration": true,
"declarationDir": ".output"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Asset Size Chunks Chunk Names
bundle.js 5.13 KiB main [emitted] main
app.d.ts.map 194 bytes [emitted]
app.d.ts.map 197 bytes [emitted]
app.d.ts 143 bytes [emitted]
sub/dep.d.ts.map 142 bytes [emitted]
sub/dep.d.ts.map 152 bytes [emitted]
sub/dep.d.ts 96 bytes [emitted]
Entrypoint main = bundle.js
[./app.ts] 910 bytes {main} [built]
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"declaration": true,
"declarationMap": true
"declarationMap": true,
"declarationDir": ".output"
}
}

0 comments on commit 1cc576d

Please sign in to comment.