Plugins: Wrong complierOptions when tsconfig in cwd is extended from another tsconfig

Created on 24 Feb 2019  ·  16Comments  ·  Source: rollup/plugins

For example:

{
  "extends": "../../tsconfig.base.json",
  "compilerOptions": {
    "rootDir": "./src",
    "outDir": "./dist",
    "declaration": false
  }
}

Seems that rollup-plugin-typescript does not try to resolve the base tsconfig, so that the compilerOptions is not extended.

t¹ 🐞 bug 🔌 plugin-typescript

All 16 comments

I also had this same problem but I went further and had a peek into the source code of the plugin and found that it only imports the compilerOptions object from the tsconfig.json file.

There isn't any easy workaround for this issue because TypeScript Compiler API only takes compilerOptions as an argument for their transpilation functions as shown in their official docs.

If I were one of the core maintainers of this plugin I would consider changing the tsconfig property name to compilerOptions as it better describes what it really does. WDYT @Victorystick?

Hey folks (this is a canned reply, but we mean it!). Thanks to everyone who participated in this issue. We're getting ready to move this plugin to a new home at https://github.com/rollup/plugins, and we have to do some spring cleaning of the issues to make that happen. We're going to close this one, but it doesn't mean that it's not still valid. We've got some time yet before the move while we resolve pending Pull Requests, so if this issue is still relevant, please @ me and I'll make sure it gets transferred to the new repo. :beer:

@shellscape This still a relevant problem!

That extended tsconfigs are not supported should be documented or fixed.

Thanks for all your hard work!

This should be fixed by https://github.com/rollup/rollup-plugin-typescript/pull/153, please let us know if it's not.

@shellscape I don't think it's fixed. I'm getting

@rollup/plugin-typescript: Couldn't process compiler options

when using extends: 'my-package where 'my-package' is a module in my monorepo

@NotWoods any thoughts?

Uh I have a look at rollup/rollup-plugin-typescript#153, seems that it does not solve muti-level extends?

I'm going to reopen the issue and try to solve the failing use cases described here.

I can confirm that the issue is still present. @NotWoods @shellscape do you have any progress with this? Maybe there is a way to use TypeScript compiler API to actually process the config as tsc does?

Could you provide a REPL link with an example of what's failing? We are using the compiler APIs Typescript provides already. The upcoming 4.0.0 version should fix some more issues too.

Well, as others mentioned, I have a very simple setup with two tsconfig.json files, where one file is extending the other one. However, the compiler options are loaded only from the specified file. Options in the base config are getting totally ignored.

Are you using TypeScript compiler to load the config or are you loading it yourselves? I've tried to find a code that is responsible for loading tsconfig.json in tsc yesterday, but failed to do so due to the complexity and the size of the codebase. Could you please point me in the right direction if you are familiar with the codebase?

The examples in this issue all work now, so I would really appreciate the exact configuration you're using that doesn't work. I can't point to an exact location in the Typescript repo but we use the APIs provided by Typescript for parsing the configuration.

I would have been glad to assist with this issue further, but we have had to switch to the rollup-plugin-typescript2 due to the lack of some critical features in this plugin. Sorry about that… 😢

However, if this helps in resolving this bug: config inheritance started to work correctly when I switched plugins.

Fixed in version 4.0.0 of the typescript plugin

@NotWoods Still not working 🙂rollup-plugin-typescript2 works fine.

I'm getting a similar issue with version 5.0.2: Couldn't process compiler options. I had to switch to rollup-plugin-typescript2 to solve the issue :/

Was this page helpful?
0 / 5 - 0 ratings