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

Options from extended tsconfig.json are ignored #131

Closed
wangweixuan opened this issue Jan 11, 2019 · 2 comments
Closed

Options from extended tsconfig.json are ignored #131

wangweixuan opened this issue Jan 11, 2019 · 2 comments
Assignees
Labels
kind: bug Something isn't working properly kind: feature New feature or request

Comments

@wangweixuan
Copy link

What happens and why it is wrong

When parsing tsconfig.json, the options are overridden using a naive merge method before they are actually parsed. This leads to certain options (e.g. module) extended from a base tsconfig being ignored unexpectedly and unconditionally.

const mergedConfig = {};
_.merge(mergedConfig, getOptionsDefaults(), pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
const preParsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, getOptionsOverrides(pluginOptions), configFileName);
const compilerOptionsOverride = getOptionsOverrides(pluginOptions, preParsedTsConfig);
const parsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, compilerOptionsOverride, configFileName);

Versions

All latest.

tsconfig.json

{
  "extends": "./tsconfig.base"
}

tsconfig.base.json

{
  "compilerOptions": {
    "module": "esnext"
  }
}

plugin output with verbosity 3

// truncated
rpt2: parsed tsconfig: {
    "options": {
        "module": 5,                                // UNEXPECTED
        "configFilePath": "/path/to/tsconfig.json",
        // truncated
    },
    // truncated
    "raw": {
        "compilerOptions": {
            "module": "ES2015"                      // UNEXPECTED
        },
        "extends": "./tsconfig.base",
        "compileOnSave": false
    },
    // truncated
}
// truncated
ezolenko added a commit that referenced this issue Jan 16, 2019
@ezolenko
Copy link
Owner

Yep, only affects module. Should be fixed in master now

@ezolenko ezolenko self-assigned this Jan 16, 2019
@ezolenko
Copy link
Owner

ezolenko commented Jan 18, 2019

Fixed in 0.19.2

@agilgur5 agilgur5 added kind: bug Something isn't working properly kind: feature New feature or request labels May 21, 2022
Repository owner locked as resolved and limited conversation to collaborators May 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: bug Something isn't working properly kind: feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants