Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lordrip
Copy link
Member

@lordrip lordrip commented Mar 20, 2025

Context

Starting with node.js 21, the --loader is no longer valid, making the build to fail.

This commit transforms the .mts file to a .mjs file so we don't need to use the typescript loader. It also removes the warning generated by importing JSON files.

The JSON import problem was handled thanks to @petersem nodejs/node#51347 (comment)

fix: #1936
relates: nodejs/node#51347

@lordrip lordrip requested review from apupier and igarashitm March 20, 2025 14:16
@codecov
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.61%. Comparing base (60234e8) to head (5bbe196).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2104      +/-   ##
============================================
+ Coverage     81.48%   81.61%   +0.12%     
  Complexity      455      455              
============================================
  Files           537      537              
  Lines         16823    17000     +177     
  Branches       3302     3538     +236     
============================================
+ Hits          13708    13874     +166     
- Misses         2856     2867      +11     
  Partials        259      259              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@apupier
Copy link
Member

apupier commented Mar 20, 2025

when using Node 22, I have a compilation error locally with yarn workspace @kaoto/kaoto run build:lib:

import packageJson from '../package.json' assert { type: 'json' };
                                          ^^^^^^

SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:338:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:102:18)
    at #translate (node:internal/modules/esm/loader:468:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:515:27)
    at async ModuleJob._link (node:internal/modules/esm/module_job:115:19)

using Node.js v22.14.0

@lordrip lordrip marked this pull request as ready for review March 21, 2025 12:34
Copy link
Member

@apupier apupier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build fine with Node 22 and works with VS Code extension built with Node 20

Starting with node.js 21, the `--loader` is no longer valid, making the
build to fail.

This commit transform the `.mts` file to a `.mjs` so we don't need to
use the `typescript` loader and it also removes the warning generated by
importing JSON files.

The node.js version for the github actions is also updated.

The JSON import problem was handled thanks to @petersem
nodejs/node#51347 (comment)

fix: KaotoIO#1936
relates: nodejs/node#51347
@lhein lhein force-pushed the fix/node22-build branch from a7904f7 to 5bbe196 Compare March 24, 2025 15:02
@sonarqubecloud
Copy link

@lhein lhein merged commit e69ca5d into KaotoIO:main Mar 24, 2025
13 checks passed
@lordrip lordrip deleted the fix/node22-build branch June 25, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[yarn] - Unable to install the node modules with Node 22+

4 participants