TypeStrong/ts-loader

[Question/Bug] ts-loader ignore outDir in tsconfig.json

dinfer opened this issue · 1 comments

All the ts files are compiled and the project works fine. but the files generated from ts are just in the same folder. I just want my src code to be clean, so I set outDir in tsconfig.json, but nothing changed. What should I do to make ts-loader generate js file to other location? sourceMap: true doesn't works too.

In the output. ts-loader is using the tsconfig.json as I wrote. And, when using tsc to compile, the code is generated as expected(into dist folder). Is something wrong with my configs?

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "sourceMap": true,
    "outDir": "./dist",
    "strict": true
  },
  "include": [
    "./src/**/*.ts"
  ]
}

I also try to set compiler options in the rule config, but it does work either.

{
  test: /\.ts$/,
  loader: 'ts-loader',
  options: {
    compilerOptions: {
      outDir: './dist/'
    }
  }
}

The outDir "stuff" is dealt with by webpack rather than by ts-loader. It might be worth you taking a look at some of the simple setups. This is probably a good place to start: https://github.com/TypeStrong/ts-loader/tree/master/examples/vanilla

Will close as I don't think this is an issue.