ts-loader
ts-loader copied to clipboard
Not working with TypeScript 5.0.2
Expected Behaviour
After updating the project to TypeScript 5.0.2, it should build.
Actual Behaviour
It throws errors like this:
Module build failed (from ../../common/temp/node_modules/.pnpm/ts- [email protected][email protected][email protected]/node_modules/ts-loader/index.js): TypeError: ts.createTemplateHead is not a function
Steps to Reproduce the Problem
Update to TypeScript 5.0.2 in a project using ts-loader.
Location of a Minimal Repository that Demonstrates the Issue.
Will add this in case this is an unexpected issue.
interesting - createTemplateHead
doesn't appear to be an API ts-loader uses
In addition it doesn't work anymore when loading other compiler like ttypescript. The reason for this is that ts-loader can't find it anymore.
Interesting. So https://github.com/TypeStrong/ts-loader#compiler doesn't work with 5.0? I wonder if that's linked to the (major) changes to the internals of TypeScript that happened as part of 5.0
As I mentioned in another issue, after upgrade all tooling, latest webpack, latest ts-loader, all works fine with Typescript 5.0.x.
My ts-loader configuration for webpack is pretty simple
rules: [
{
test: /\.tsx?$/,
use: [
"babel-loader",
{
loader: "ts-loader",
options: {
onlyCompileBundledFiles: true,
},
},
],
},
]