-
-
Notifications
You must be signed in to change notification settings - Fork 433
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
TS6307: JSON files not in file list when using composite projects #905
Comments
Possibly.... Have you bumped on this @andrewbranch? |
Hmm, nope, that's new to me. Would be happy to take a look at it sometime, but I'm about to be traveling (without a computer) for the next few weeks 🙈 |
Have great travels! It's good to be away from the keyboard every now and then 😁 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@stalebot relax, I'll put it on my to-do list |
I'm getting this as well:
I have
set inside |
This appears to be a TypeScript bug here: https://github.com/microsoft/TypeScript/blob/eeba30afc81e2c7c8a34a2deb0d4d2375a1c21f6/src/compiler/program.ts#L2771-L2774 I think either the JSON file should be in the program’s rootFiles when Here's a minimal repro: Compile with: import * as ts from 'typescript';
const commandLine = ts.parseJsonSourceFileConfigFileContent(ts.readJsonConfigFile('tsconfig.json', ts.sys.readFile), ts.sys, '.');
console.log(commandLine.fileNames);
const program = ts.createProgram({
rootNames: commandLine.fileNames,
options: commandLine.options,
});
const diagnostics = program.getOptionsDiagnostics();
console.log(ts.formatDiagnostics(diagnostics, {
getCanonicalFileName: fileName => fileName,
getCurrentDirectory: ts.sys.getCurrentDirectory,
getNewLine: () => '\n',
})); tsconfig.json {
"compilerOptions": {
"moduleResolution": "node",
"target": "es5",
"composite": true,
"resolveJsonModule": true
},
"include": [
"*.ts",
"*.json"
]
} foo.ts import * as foo from './foo.json'; foo.json {} /cc @sheetalkamat what's the expected behavior here? |
@andrewbranch This works with tsc but not with the sample repro code you gave because your base path is not resolved? (changing that to say 'c:/temp/test2' works). That's because https://github.com/microsoft/TypeScript/blob/master/src/compiler/commandLineParser.ts#L2729 expects basePath to be the first thing in the json matching pattern |
Ah yes, that does fix my repro. I think ts-loader must be making a similar mistake, because the JSON files were definitely not in the program. This really helps narrow it down, thanks! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
this is still an issue |
Has anybody come across a workaround for this issue (other than not using composite projects)? |
I’ll try to take a look at this over the weekend. |
You are a prince among men @andrewbranch 🤴 |
Ensure that json files are resolved if resolveJsonModule flag is set in tsconfig
I spent a couple hours digging into this after @mvargeson shared with me. Ideally you'd be able to use the regex generated internally by the typescript compiler instead of generating our own but I couldn't find a way that it was exposed. |
…trong#905) (TypeStrong#1101) * Fix TypeStrong#905 Ensure that json files are resolved if resolveJsonModule flag is set in tsconfig * Add test * PR Comments
Still an issue |
Bump, ended up here from Google and it is still an issue. |
It is still an issue. |
Any updates on this? |
…cies (#774) * feat: update dependencies, delete Cypress and add Playwright tests as workspace Relates to: kubeshop/testkube#3856 * feat: use default Webpack minification process, along with sourcemaps * fix: ignore generated Playwright results for Prettier * feat: update Monaco Editor * add "test/dashboard-e2e" to tsconfig file * chore: delete unused terser-webpack-plugin * fixup chore: delete unused terser-webpack-plugin * feat: use tsconfig-paths-webpack-plugin instead of deprecated craco-alias * feat: avoid installing Chromium in the Docker image * feat: add TypeScript types to Playwright tests * fix: replace JSON fixtures with TS @see {@link TypeStrong/ts-loader#905} * fix: run unit tests with proper modules mapping * fixup make "husky" optional for prepare script * fix: increase max timeout for waiting for Vercel preview * fix: lock Playwright version to v1.32.3 * fix: avoid segmentation fault in Stylelint * chore: avoid separate tsconfig for test files * fixup spec types
microsoft/TypeScript#25636 (comment)
|
{ |
Expected Behaviour
Using
resolveJsonModule
andcomposite
projects works astsc
does.Note that
tsc
has had some issues with this that were solved in microsoft/TypeScript#25636 and thattsc
works correctly now. See reproduction below.Actual Behaviour
Steps to Reproduce the Problem
Location of a Minimal Repository that Demonstrates the Issue.
https://github.com/thovden/tsloader-ts6307
The text was updated successfully, but these errors were encountered: