Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue with incorrect output path for declaration files #822

Merged
merged 3 commits into from
Sep 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"
}
}