awesome-typescript-loader icon indicating copy to clipboard operation
awesome-typescript-loader copied to clipboard

strange behaviour with 'extends' option at tsconfig.json

Open plandem opened this issue 8 years ago • 4 comments

{
  "compilerOptions": {
    "jsx": "react",
    "outDir": "../../dist/web",
    "paths": {
      "web/*": ["../web/*"],
      "shared/*": ["../shared/*"]
    }
  },
  "extends": "../../tsconfig.base"
}

with ATL I see errors about files that must be invisible (e.g. TSC/ts-loader works as supposed).

plandem avatar Jul 05 '17 21:07 plandem

I have found that TsConfigPathsPlugin does not resolve all the "extends" parent properties

Say if you have these configuration files

tsconfig.base.json

{
  "compilerOptions": {
    "baseUrl": "node_modules"
  }
}

tsconfig.json

{
  "extends": "./tsconfig-base.json",
}

Then this throws errors

resolve: {
	plugins: [
		new TsConfigPathsPlugin({
			context: path.resolve("./"),
			tsconfig: path.resolve("./tsconfig.json"),
			configFileName: path.resolve("./tsconfig.json"),
		})
	]
},

This works, however you miss any props you may have had in tsconfig.json (may be acceptable)

resolve: {
	plugins: [
		new TsConfigPathsPlugin({
			context: path.resolve("./"),
			tsconfig: path.resolve("./tsconfig-base.json"),
			configFileName: path.resolve("./tsconfig-base.json"),
		})
	]
},

Or can just do

resolve: {
	plugins: [
		new TsConfigPathsPlugin({
			context: path.resolve("./"),
			"baseUrl": "node_modules",
		})
	]
},

djeeg avatar Jul 29 '17 14:07 djeeg

I've having also an issue that ATL doesn't honor tsconfig's "extends" property, and so my "baseUrl" and "paths" properties of my custom tsconfig.project.json (that extends a tsconfig.json) don't get resolved.

ATL v3.2.2 TypeScript v2.4.2 Webpack v3.4.1

ghost avatar Aug 05 '17 11:08 ghost

I have the same problem. Impossible to use "extends" in tsconfig with ATL!

mlessd avatar Dec 05 '17 03:12 mlessd

+1

WingGao avatar Jun 17 '19 13:06 WingGao