Skip to content

Commit

Permalink
Merge pull request #79 from remix-pwa/nightly
Browse files Browse the repository at this point in the history
chore(dev): fixed config path resolution in compiler
  • Loading branch information
ShafSpecs authored Sep 24, 2023
2 parents cc5969b + 5dd6605 commit 77d268a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/dev/compiler/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { readConfig as _readConfig, findConfig } from '@remix-run/dev/dist/confi
import type { ServerMode } from '@remix-run/dev/dist/config/serverModes.js';
import { existsSync } from 'node:fs';
import { createRequire } from 'node:module';
import { platform } from 'node:os';
import { resolve } from 'node:path';
import { pathToFileURL } from 'node:url';

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

Expand Down Expand Up @@ -62,12 +64,18 @@ function findEntry(dirname: string, basename: string): string | undefined {
}
}

const isWindows = platform() === 'win32';

const resolveUrl = (string: string) => {
return isWindows ? pathToFileURL(string).href : string;
};

/**
* Reads the remix.config.js file and returns the config object.
*/
export default async function readConfig(remixRoot: string, mode: ServerMode): Promise<ResolvedWorkerConfig> {
const remixConfig = await _readConfig(remixRoot, mode);
const workerConfig = (await import(findConfig(remixRoot, 'remix.config', EXTENSIONS) as string).then(
const workerConfig = (await import(resolveUrl(findConfig(remixRoot, 'remix.config', EXTENSIONS) as string)).then(
m => m.default ?? m
)) as WorkerConfig;

Expand Down

0 comments on commit 77d268a

Please sign in to comment.