Skip to content

Commit

Permalink
Resolve relative imports correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwilsonperkin committed Jan 23, 2023
1 parent 6f741d9 commit 49850b1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/graphql-mini-transforms/src/esbuild-plugin.ts
@@ -1,4 +1,5 @@
import fs from 'fs';
import {dirname} from 'path';

import {parse, DocumentNode} from 'graphql';
import type {Plugin, PluginBuild} from 'esbuild';
Expand Down Expand Up @@ -39,6 +40,7 @@ async function loadDocument(
imports.map(async (imported) => {
const resolved = await build.resolve(imported, {
kind: 'import-statement',
resolveDir: dirname(path),
});
if (resolved.errors.length > 0) {
throw new Error(JSON.stringify(resolved.errors), null, 2);
Expand Down

0 comments on commit 49850b1

Please sign in to comment.