From 6d3c3b3c5a36c3c70d8011cf117eb093f92726b9 Mon Sep 17 00:00:00 2001 From: Max Metral Date: Tue, 12 Dec 2023 23:49:07 -0500 Subject: [PATCH] fix(ts): ts can always use import --- package.json | 2 +- src/passthrough.ts | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 030c396..bddaa30 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coconfig", - "version": "1.4.0", + "version": "1.4.1", "description": "Centralize your per-package rc, dotfile and config files into one extensible config file", "main": "build/index.js", "types": "build/index.d.ts", diff --git a/src/passthrough.ts b/src/passthrough.ts index 606c380..e745f98 100644 --- a/src/passthrough.ts +++ b/src/passthrough.ts @@ -46,7 +46,7 @@ const { configuration } = configItem && configItem['${key}']; const resolved = typeof configuration === 'function' ? configuration() : configuration; `; - if (isModule && isTs) { + if (isTs) { return `${header} import cjs from '${modulePath}'; import * as esmToCjs from '${modulePath}'; @@ -71,13 +71,6 @@ export default resolved;\n`; const isCoconfigTs = /.[cm]?ts/.test(path.extname(env.coconfigPath)); - if (isCoconfigTs && isTs) { - return `${header} -const configModule = require('${modulePath}'); -${commonCode} -module.exports = resolved;\n`; - } - if (isCoconfigTs) { // Target is JS, source is typescript (requires ts-node) return `${header}