Repository navigation
Conversation
| | `string` | `'typescript'` | | ||
| | Type | Default Value | | ||
| | ------------------------------------------ | -------------- | | ||
| | `string \| { API, createFileSystemLayer }` | `'typescript'` | |
There was a problem hiding this comment.
I don't think the documentation is correct - here; it's an object that's passed and default value is not 'typescript'?
There was a problem hiding this comment.
default is typescript used here https://github.com/TypeStrong/ts-loader/pull/1725/changes/BASE..f110b488792612b481dea18cdd36fb998b123170#diff-1bded13bfea4654df3b721738a266a835230e5539fe6fd27bc822e42a01ecd6fR44
const compiler =
typeof loaderOptions.compiler === 'object'
? loaderOptions.compiler
: requireCompiler(loaderOptions.compiler ?? 'typescript');There was a problem hiding this comment.
That's true - but it's quite peculiar!
Effectively the type is (I think):
'typescript' |
{
createFileSystemLayer: (files: RequestFileEntries, options?: CreateFileSystemOptions) => RequestFileSystem;
API: new (options?: APIOptions) => API;
}I think it would be better if the default was undefined and that 'typescript' | was removed from the union. Do you see what I mean?
There was a problem hiding this comment.
but we can pass string like 'typescript-beta' or some other string that will be resolved in requireCompiler
maybe I am missing something
I tried to keep changes minimal, so that old configs would keep on working and only node 16 users would need to change webpack configs (pass object with API and createFileSystemLayer)
so if compiler option is missing default 'typescript' is used and required in requireCompiler
| /** `API` from `typescript/sync` and `createFileSystemLayer` from `typescript/fs`. */ | ||
| export interface TypeScriptCompilerModules { | ||
| API: new (options?: APIOptions) => API; | ||
| createFileSystemLayer: typeof createFileSystemLayer; |
There was a problem hiding this comment.
would this approach work if we didn't pass createFileSystemLayer - my guess is no, but I'm curious
|
Unfortunately the execution test you added can't be run on Node 16 as Node 16 is incompatible with Jasmine 7. |
Install and build on Node 26 (Jasmine 7 and the dev tooling need it), then switch to Node 16 for the build-only suppliedCompiler test, which never loads Jasmine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for putting this together @aovchinn! I've added a CI job that installs and builds on Node 26, then switches to Node 16 to run With TypeScript (job log) The latest TypeScript nightlies load Node built-ins through So Node 16 support would only work with Can you think of an approach to tackle this? |
|
I think that microsoft/TypeScript#64174 stopped this PR from being viable as is.
|
|
yeah, in light of that new info I think it is not possible to support node 16 |
|
well done for trying though! Before the latest changes I think this was looking quite promising |
#1721
this is just a PR version of the patch sent in a comment #1721 (comment)
I don't know how tests are supposed to run with different node versions, maybe supporting node16 is indeed just not worth the effort
added one "artificial" test, it passes on node 16 with
npm run execution-tests -- --single-test suppliedCompiler