cli: remove support for implicit module extensions + allow .?ts

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-12-24 13:42:00 +01:00
parent e00a634225
commit d7b0ef9515
6 changed files with 28 additions and 36 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ import { existsSync } from 'fs';
const DEFAULT_MODULE_FORMAT = 'commonjs';
// Source file extensions to look for when using bundle resolution strategy
const EXTS = ['.ts', '.js', '.mts', '.cts', '.mjs', '.cjs'];
const SRC_EXTS = ['.ts', '.js'];
const TS_EXTS = ['.ts', '.mts', '.cts'];
const moduleTypeTable = {
'.mjs': 'module',
@@ -177,7 +177,7 @@ async function findPackageJSON(startPath) {
/** @type {import('module').ResolveHook} */
async function resolveWithoutExt(specifier, context, nextResolve) {
for (const tryExt of EXTS) {
for (const tryExt of SRC_EXTS) {
try {
const resolved = await nextResolve(specifier + tryExt, {
...context,
+1
View File
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"allowImportingTsExtensions": true,
"allowJs": true,
"declaration": true,
"declarationMap": false,