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

Wrong complierOptions when tsconfig in cwd is extended from another tsconfig #70

Closed
meteorlxy opened this issue Feb 24, 2019 · 16 comments
Closed

Comments

@meteorlxy
Copy link

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.

@Tylerian
Copy link

Tylerian commented Jul 31, 2019

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?

@shellscape
Copy link
Collaborator

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. 🍺

@jacksteamdev
Copy link
Contributor

@shellscape This still a relevant problem!

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

Thanks for all your hard work!

jacksteamdev referenced this issue in jacksteamdev/rollup-plugin-typescript Nov 28, 2019
Document that extended tsconfigs are not supported. See #135
@shellscape shellscape reopened this Dec 3, 2019
@shellscape shellscape transferred this issue from rollup/rollup-plugin-typescript Dec 3, 2019
@shellscape
Copy link
Collaborator

This should be fixed by rollup/rollup-plugin-typescript#153, please let us know if it's not.

@cortopy
Copy link

cortopy commented Feb 2, 2020

@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

@shellscape
Copy link
Collaborator

@NotWoods any thoughts?

@meteorlxy
Copy link
Author

meteorlxy commented Feb 2, 2020

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

@NotWoods
Copy link
Member

NotWoods commented Feb 3, 2020

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

@slavafomin
Copy link

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?

@NotWoods
Copy link
Member

NotWoods commented Mar 2, 2020

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.

@slavafomin
Copy link

slavafomin commented Mar 3, 2020

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?

@NotWoods
Copy link
Member

NotWoods commented Mar 3, 2020

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.

@slavafomin
Copy link

slavafomin commented Mar 3, 2020

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.

@NotWoods
Copy link
Member

NotWoods commented Mar 6, 2020

Fixed in version 4.0.0 of the typescript plugin

@NotWoods NotWoods closed this as completed Mar 6, 2020
@developer239
Copy link

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

@bleucitron

This comment has been minimized.

@rollup rollup deleted a comment from lake2 Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants