ricokahler / babel-plugin-tsconfig-paths-module-resolver

Use tsconfig-paths in any bundler that supports a custom babel config.
MIT License
40 stars 2 forks source link

Custom tsConfig path #18

Open ondrej-111 opened 1 year ago

ondrej-111 commented 1 year ago

Please provide the option to specify a custom tsConfig, something like this:

[
      'babel-plugin-tsconfig-paths-module-resolver',
      {
        "tsConfig": "apps/functions/tsconfig.app.json",
      }
    ]
bsantare commented 1 year ago

You can work around this limitation by setting an environment variable pointing to the required tsconfig file before this plugin is initialized and before calling createResolvePath(). If you have a babel.config.js you can do something like:

process.env.TS_NODE_PROJECT = path.join(<someRootPath>, 'tsconfig.base.json');

before exporting the plugin configuration.

https://github.com/dividab/tsconfig-paths#config-loading-process