Skip to content

fix: remove interopDefault to use jiti's default #19697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions lib/config/config-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,17 @@ async function loadTypeScriptConfigFileWithJiti(filePath, fileURL, mtime) {
* Disabling `moduleCache` allows us to reload a
* config file when the last modified timestamp changes.
*/

const jiti = createJiti(__filename, {
const jitiOptions = {
moduleCache: false,
interopDefault: false,
});
};

// eslint-disable-next-line no-use-before-define -- `ConfigLoader.getJitiVersion` can be overwritten for testing
const jitiVersion = ConfigLoader.getJitiVersion();
if (jitiVersion.startsWith("2.1.")) {
jitiOptions.interopDefault = false;
}

const jiti = createJiti(__filename, jitiOptions);
const config = await jiti.import(fileURL.href);

importedConfigFileModificationTime.set(filePath, mtime);
Expand Down Expand Up @@ -501,6 +507,14 @@ class ConfigLoader {
return import("jiti");
}

/**
* Used to get the jiti version. This method is exposed internally for testing purposes.
* @returns {string} The version of jiti.
*/
static getJitiVersion() {
return require("jiti/package.json").version;
}

/**
* Determines which config file to use. This is determined by seeing if an
* override config file was specified, and if so, using it; otherwise, as long
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@
"globals": "^15.0.0",
"got": "^11.8.3",
"gray-matter": "^4.0.3",
"jiti": "^2.1.0",
"jiti": "^2.2.0",
"jiti-v2.0": "npm:jiti@2.0.x",
"jiti-v2.1": "npm:jiti@2.1.x",
"knip": "^5.32.0",
"lint-staged": "^11.0.0",
"load-perf": "^0.2.0",
Expand Down
Loading
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy