Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
strategy:
matrix:
node: [20, 22]
ts: [4.4.2, 4.5.2, 4.6.2, 4.7.3, 4.8.2, 4.9.3, 5.0.4, 5.1.3, 5.2.2, 5.3.3, 5.4.2, 5.5.3, 5.6.2, 5.7.2, 5.8.2, next]
ts: [5.0.4, 5.1.3, 5.2.2, 5.3.3, 5.4.2, 5.5.3, 5.6.2, 5.7.2, 5.8.2, 5.9.2, next]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -76,7 +76,7 @@ jobs:
strategy:
matrix:
node: [20, 22]
ts: [4.4.2, 4.5.2, 4.6.2, 4.7.3, 4.8.2, 4.9.3, 5.0.4, 5.1.3, 5.2.2, 5.3.3, 5.4.2, 5.5.3, 5.6.2, 5.7.2, 5.8.2, next]
ts: [5.0.4, 5.1.3, 5.2.2, 5.3.3, 5.4.2, 5.5.3, 5.6.2, 5.7.2, 5.8.2, 5.9.2, next]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 9.5.3
* [chore: typescript 5.9 upgrade](https://github.com/TypeStrong/ts-loader/pull/1676) - thanks @johnnyreilly

## 9.5.2
* [fix: add more detailed error messages](https://github.com/TypeStrong/ts-loader/pull/1665) - thanks @hai-x

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-loader",
"version": "9.5.2",
"version": "9.5.3",
"description": "TypeScript loader for webpack",
"main": "index.js",
"types": "dist",
Expand Down Expand Up @@ -94,7 +94,7 @@
"mocha": "^6.0.0",
"prettier": "^2.0.5",
"rimraf": "^2.6.2",
"typescript": "^5.8.2",
"typescript": "^5.9.2",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/after-compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ function removeCompilationTSLoaderErrors(
loaderOptions: LoaderOptions
) {
compilation.errors = compilation.errors.filter(
error => error.details !== tsLoaderSource(loaderOptions)
error => error instanceof webpack.WebpackError && error.details !== tsLoaderSource(loaderOptions)
);
}

Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ function makeLoaderOptions(
const hasForkTsCheckerWebpackPlugin =
loaderContext._compiler?.options.plugins.some(
plugin =>
plugin !== null &&
typeof plugin === 'object' &&
plugin.constructor?.name === 'ForkTsCheckerWebpackPlugin'
);
Expand Down Expand Up @@ -477,7 +478,7 @@ function getEmit(

addDependenciesFromSolutionBuilder(instance, filePath, addDependency);

loaderContext._module!.buildMeta.tsLoaderDefinitionFileVersions =
if (loaderContext._module && loaderContext._module.buildMeta) loaderContext._module.buildMeta.tsLoaderDefinitionFileVersions =
dependencies.map(
defFilePath =>
path.relative(loaderContext.rootContext, defFilePath) +
Expand Down
2 changes: 1 addition & 1 deletion src/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function successfulTypeScriptInstance(
error: makeError(
loaderOptions,
colors.red('error while reading tsconfig.json:' + EOL + message),
file
file ?? ''
),
};
}
Expand Down
6 changes: 5 additions & 1 deletion src/watch-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,14 @@ function updateFile(
loader.loadModule(request, (err, source) => {
if (err) {
reject(err);
} else {
} else if (typeof source === 'string') {
const text = JSON.parse(source);
updateFileWithText(instance, key, filePath, () => text);
resolve();
} else if (Buffer.isBuffer(source)) {
const text = JSON.parse(source.toString('utf8'));
updateFileWithText(instance, key, filePath, () => text);
resolve();
}
});
} else {
Expand Down
67 changes: 0 additions & 67 deletions test/comparison-tests/aliasResolution/expectedOutput-5.8/bundle.js

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

67 changes: 67 additions & 0 deletions test/comparison-tests/aliasResolution/expectedOutput-5.9/bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({

/***/ "./app.ts":
/*!****************!*\
!*** ./app.ts ***!
\****************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar myComponent = __webpack_require__(/*! components/myComponent */ \"./common/components/myComponent.ts\");\nconsole.log(myComponent);\n\n\n//# sourceURL=webpack:///./app.ts?\n}");

/***/ }),

/***/ "./common/components/myComponent.ts":
/*!******************************************!*\
!*** ./common/components/myComponent.ts ***!
\******************************************/
/***/ ((module) => {

eval("{\nmodule.exports = 'myComponent';\n\n\n//# sourceURL=webpack:///./common/components/myComponent.ts?\n}");

/***/ })

/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = __webpack_require__("./app.ts");
/******/
/******/ })()
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
asset bundle.js 2.65 KiB [emitted] (name: main)
./app.ts 156 bytes [built] [code generated] [2 errors]
./common/components/myComponent.ts 46 bytes [built] [code generated]

ERROR in app.ts
./app.ts 1:29-53
[tsl] ERROR in app.ts(1,30)
 TS2307: Cannot find module 'components/myComponent' or its corresponding type declarations.
ts-loader-default_609318b4f68865d3

ERROR in app.ts
./app.ts 2:30-55
[tsl] ERROR in app.ts(2,31)
 TS2307: Cannot find module 'components/myComponent2' or its corresponding type declarations.
ts-loader-default_609318b4f68865d3

webpack compiled with 2 errors
Loading
Loading