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

compilerOptions.declaration=true in tsconfig.json with output.path in webpack.config.js incorrectly nests *.d.ts file #238

Closed
astralarya opened this issue Jul 8, 2016 · 1 comment

Comments

@astralarya
Copy link

astralarya commented Jul 8, 2016

Setting compilerOptions.declaration=true in tsconfig.json with output.path defined in webpack.config.js incorrectly nests resulting *.d.ts file within output path.

Minimal example
ts-loader-declarations-bug.zip

package.json

{
  "name": "ts-loader-declarations-bug",
  "version": "1.0.0",
  "description": "Minimal example of ts-loader declarations bug",
  "main": "dist/output.js",
  "scripts": {
    "prepublish": "webpack",
    "test": "webpack"
  },
  "author": "Mara Kim",
  "license": "ISC",
  "devDependencies": {
    "ts-loader": "^0.8.2",
    "typescript": "^1.8.10",
    "webpack": "^1.13.1"
  }
}

tsconfig.json

{
    "compilerOptions": {
        "declaration": true
    }
}

webpack.config.js

module.exports = {
    entry: './input.ts',
    output: {
        path: __dirname + '/dist',
        filename: 'output.js',
    },
    module: {
        loaders: [
            {
                test: /\.ts$/,
                loader: "ts-loader",
            },
        ],
    },
};

input.ts

export default class {
    foo():number {
        return 42;
    }
}

To build:

npm install

Current output

Try ls -R dist to view the output directory. The output files are output.js and a weirdly nested *.d.ts file whose location can be described as follows:

If the global location of the ts-loader-declarations-bug directory is $PACKAGE, the *.d.ts file is located at $PACKAGE/dist/$PACKAGE/input.d.ts.

Expected output

The *.d.ts file should be located at $PACKAGE/dist/input.d.ts.

Miscellaneous

There is also currently no way to change the name of the resulting *.d.ts file.

Environment

  • ts-loader: 0.8.2
  • typescript: 1.8.10
  • webpack: 1.13.1
  • node: 6.2.2
  • Operating System: Mac OSX 10.11.5
@johnnyreilly
Copy link
Member

Think this is resolved with 0.9.1

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

No branches or pull requests

2 participants