Skip to content

Commit

Permalink
deduple import statments for compiled documents
Browse files Browse the repository at this point in the history
  • Loading branch information
cometkim committed May 6, 2024
1 parent 5386022 commit 0053627
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/lucky-coins-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vite-plugin-relay-lite": patch
---

Dedupe import statements for compiled documents
3 changes: 0 additions & 3 deletions src/compile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,8 @@ test('mixed case', () => {
expect(result.code).toMatchInlineSnapshot(`
"import graphql__f4ce3be5b8e81a99157cd3e378f936b6 from "./__generated__/Test.graphql";
import graphql__be4d44055d9f79bc8ffc68b6e8277222 from "./__generated__/TestFragment.graphql";
import graphql__be4d44055d9f79bc8ffc68b6e8277222 from "./__generated__/TestFragment.graphql";
import graphql__f4ce3be5b8e81a99157cd3e378f936b6 from "./__generated__/Test.graphql";
import graphql__37866396c946bd011298fc64841dcb46 from "./__generated__/TestTruthy.graphql";
import graphql__60fd06bd826b4b4bd4d4bb065b9f6e73 from "./__generated__/TestFalsy.graphql";
import graphql__f4ce3be5b8e81a99157cd3e378f936b6 from "./__generated__/Test.graphql";
import external from 'x/y';
const host = \`\${host}/graphql\`;
Expand Down
2 changes: 1 addition & 1 deletion src/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function compile(
});

content.prepend(
[...imports, ''].join('\n'),
[...new Set(imports), ''].join('\n'),
);

return {
Expand Down

0 comments on commit 0053627

Please sign in to comment.