TypeStrong / ts-loader

TypeScript loader for webpack
https://johnnyreilly.com/ts-loader-goes-webpack-5
MIT License
3.44k stars 429 forks source link

Not working with TypeScript 5.0.2 #1600

Open dbartholomae opened 1 year ago

dbartholomae commented 1 year ago

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- loader@9.4.2_typescript@5.0.2+webpack@5.76.3/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.

johnnyreilly commented 1 year ago

interesting - createTemplateHead doesn't appear to be an API ts-loader uses

Baumgaer commented 1 year ago

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.

johnnyreilly commented 1 year ago

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

MirKml commented 1 year ago

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,
                            },
                        },
                    ],
                },
        ]