File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1268,11 +1268,12 @@ func fileURL(location string) string {
12681268
12691269// typeScriptConfigLoaderSource returns the TypeScript source of the ephemeral
12701270// loader script that ttsx executes to evaluate a TypeScript lint config file.
1271- // `importLiteral` is a JSON-encoded relative import path (e.g. `"./lint.config.ts"`)
1272- // that is spliced directly into the `import * as` statement, so it must
1273- // already be a valid JSON string (produced by json.Marshal) .
1271+ // `importLiteral` is a JSON-encoded file URL (produced by json.Marshal). It is
1272+ // assigned to a variable before `import(configUrl)` so tsgo does not try to
1273+ // statically resolve the file URL during the loader build .
12741274func typeScriptConfigLoaderSource (importLiteral string ) string {
1275- return fmt .Sprintf (`const importedConfig = await import(%s);
1275+ return fmt .Sprintf (`const configUrl = %s;
1276+ const importedConfig = await import(configUrl);
12761277
12771278declare const process: {
12781279 stdout: { write(value: string): void };
Original file line number Diff line number Diff line change @@ -394,7 +394,9 @@ function readCjsConfigPlugins(configPath: string): ConfigPluginEntry[] {
394394// collects every `plugins` map, and serialises each plugin's `source` field
395395// as a JSON array for the parent process to parse — avoiding the need to
396396// serialise arbitrary in-memory plugin objects across the process boundary.
397- const TTSX_EXTRACTOR_SCRIPT = `const importedConfig = await import(%CONFIG_IMPORT%);
397+ // The URL lives in a variable so tsgo does not statically resolve it.
398+ const TTSX_EXTRACTOR_SCRIPT = `const configUrl = %CONFIG_IMPORT%;
399+ const importedConfig = await import(configUrl);
398400
399401declare const process: {
400402 cwd(): string;
You can’t perform that action at this time.
0 commit comments