rollup-plugin-typescript2 icon indicating copy to clipboard operation
rollup-plugin-typescript2 copied to clipboard

If an object is supplied as `tsconfig`, use that rather than a file

Open alshdavid opened this issue 5 years ago • 5 comments

Allow users to specify the tsconfig configuration inline in the rollup plugin configuration

rollup.config.js

plugins: [
  typescript({
    tsconfig: {
      compilerOptions: {...etc}
    }
  })
]

alshdavid avatar Feb 28 '20 04:02 alshdavid

You can achieve almost the same result using tsconfigDefaults and tsconfigOverride options, see readme.

ezolenko avatar Feb 28 '20 16:02 ezolenko

Because of the deep merge strategy, I'm unable to omit a path without creating a new tsconfig.json

alshdavid avatar Feb 28 '20 20:02 alshdavid

You could create a new tsconfig file and set its path in tsconfig option (lets you set a custom tsconfig path/name). Either leave it empty and set other options in tsconfigOverride or just set the options there directly.

ezolenko avatar Feb 29 '20 20:02 ezolenko

Currently I'm loading the users tsconfig with require(), making my changes and then storing the modified version in the .cache directory.

This works but is kinda gross

alshdavid avatar Feb 29 '20 21:02 alshdavid

Yeah, I'll eventually look at doing shallow merge where appropriate, but that's something that will need maintenance going forward (in case of tsconfig format changes)

ezolenko avatar Mar 04 '20 00:03 ezolenko

Hi folks, just doing some housekeeping in the issues. I'm going to close this one out as it's gone quite stale (no comments in 2.5+ years) and has no upvotes, so it doesn't seem to be a popular feature to implement and maintain (note that this is a volunteer, unpaid project). There are also various workaround available for this, so those may be better suited to solve this given the lack of popularity.

tsc also requires a tsconfig.json so we don't want to stray too far from that either.

With regard to shallow merging, that is a separate issue, and a bug that needs to be fixed in a breaking change eventually. Please see #86 for that.

agilgur5 avatar Sep 05 '22 20:09 agilgur5