fix(providance-analytics): Fixed issue with loading config on windows
This commit is contained in:
parent
3bd6d3fd09
commit
4aad06a10c
2 changed files with 8 additions and 2 deletions
5
.changeset/brave-pots-type.md
Normal file
5
.changeset/brave-pots-type.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'providence-analytics': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixed dynamic import for providence config on windows
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import pathLib from 'path';
|
import pathLib from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import { pathToFileURL } from 'url';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Promise<object|null>}
|
* @returns {Promise<object|null>}
|
||||||
|
|
@ -21,8 +22,8 @@ export async function getProvidenceConf() {
|
||||||
if (!confPathFound) {
|
if (!confPathFound) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
const { href: configPathUrl } = pathToFileURL(confPathFound);
|
||||||
const { default: providenceConf } = await import(confPathFound);
|
const { default: providenceConf } = await import(configPathUrl);
|
||||||
|
|
||||||
if (!providenceConf) {
|
if (!providenceConf) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue