Skip to content

Commit

Permalink
fix(ts): ts can always use import
Browse files Browse the repository at this point in the history
  • Loading branch information
djMax committed Dec 13, 2023
1 parent e79ba42 commit 6d3c3b3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
9 changes: 1 addition & 8 deletions src/passthrough.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}';
Expand All @@ -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}
Expand Down

0 comments on commit 6d3c3b3

Please sign in to comment.