Skip to content

Commit

Permalink
fix: esm
Browse files Browse the repository at this point in the history
  • Loading branch information
deleonio committed Dec 20, 2023
1 parent 6a3adaa commit 4581915
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions packages/stack/core/src/mjs/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import fs from 'fs';
import path from 'path';
import { createRequire } from 'module';

const require = createRequire(import.meta.url);

export let PROXIES: Object = {};
try {
PROXIES = require(path.resolve(process.cwd(), 'proxy.conf.json'));
PROXIES = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), 'proxy.conf.json'), 'utf-8'));
} catch (error) {
PROXIES = {};
}

const packageJsonApp = require(path.resolve(process.cwd(), 'package.json'));
const packageJsonCli = require(path.resolve(process.cwd(), 'node_modules/@leanup/stack/package.json'));
let packageJsonApp;
try {
packageJsonApp = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), 'package.json'), 'utf-8'));
} catch (error) {
packageJsonApp = {};
}

let proxyConfig;
let packageJsonCli;
try {
proxyConfig = require(path.resolve(process.cwd(), 'proxy.conf.json'));
packageJsonCli = JSON.parse(
fs.readFileSync(path.resolve(process.cwd(), 'node_modules/@leanup/stack/package.json'), 'utf-8')
);
} catch (error) {
proxyConfig = {};
packageJsonCli = {};
}

export interface Replacement {
Expand Down

0 comments on commit 4581915

Please sign in to comment.