Skip to content

webpack ts-loader error using TS 4.7 #48020

Closed
@mjbvz

Description

@mjbvz

Bug Report

🔎 Search Terms

  • webpack
  • ts-loader
  • @types

🕗 Version & Regression Information

  • This changed between versions TS 4.6-1-rc and 4.7.0-dev.20220223

💻 Code

Clone https://github.com/mjbvz/ts-47-webpack-error

In the project run:

npm i
npm run build

🙁 Actual behavior

The presence of @types/dompurify in the project triggers the following error:

ERROR in ./src/index.ts
Module build failed (from ./node_modules/ts-loader/index.js):
TypeError: path.indexOf is not a function
    at normalizeSlashes (/Users/matb/projects/san/ts-webpack/node_modules/typescript/lib/typescript.js:7691:26)
    at Object.combinePaths (/Users/matb/projects/san/ts-webpack/node_modules/typescript/lib/typescript.js:7757:28)
    at /Users/matb/projects/san/ts-webpack/node_modules/typescript/lib/typescript.js:41922:40
    at Object.firstDefined (/Users/matb/projects/san/ts-webpack/node_modules/typescript/lib/typescript.js:407:26)
    at primaryLookup (/Users/matb/projects/san/ts-webpack/node_modules/typescript/lib/typescript.js:41921:27)
    at Object.resolveTypeReferenceDirective (/Users/matb/projects/san/ts-webpack/node_modules/typescript/lib/typescript.js:41880:24)
    at /Users/matb/projects/san/ts-webpack/node_modules/ts-loader/dist/servicesHost.js:713:18
    at /Users/matb/projects/san/ts-webpack/node_modules/ts-loader/dist/servicesHost.js:128:141
    at Array.map (<anonymous>)
    at Object.resolveTypeReferenceDirectives (/Users/matb/projects/san/ts-webpack/node_modules/ts-loader/dist/servicesHost.js:128:124)

🙂 Expected behavior

This example builds under TS 4.6-rc and TS 4.5. I'm guessing something about the TS internal APIs that ts-loader depends on has changed

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalRelates to another program, environment, or user action which we cannot control.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions