Skip to content

Commit

Permalink
fix: try forward slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
luwes committed Feb 1, 2024
1 parent 12306a2 commit 49ea0b1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { env } from 'node:process';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { fileURLToPath, pathToFileURL } from 'node:url';

/**
* Video configurations
Expand Down Expand Up @@ -64,6 +64,11 @@ export async function getVideoConfig(): Promise<VideoConfigComplete> {
async function importConfig(file: string) {
const dirname = path.dirname(fileURLToPath(import.meta.url));
const absFilePath = path.resolve(file);
const filePath = path.relative(dirname, absFilePath);
return import(/* webpackIgnore: true */ filePath);
// Windows uses backslashes, so we need to replace them
// with forward slashes for the dynamic import statement to work.
const filePath = path
.relative(dirname, absFilePath)
.split(path.sep)
.join('/');
return import(/* webpackIgnore: true */ `${filePath}`);
}

0 comments on commit 49ea0b1

Please sign in to comment.