Repository: remix-run/react-router
File: packages/react-router-dev/vite/route-chunks-test.ts (TypeScript)

Code before:
        export { chunk2 };"
      `);
      expect(omitChunkedExports(code, ["chunk1", "chunk2"], {}, ...cache)?.code)
        .toMatchInlineSnapshot(`
        "import { mainImport } from "./shared";
        const main = () => mainImport;
        export { main };"
      `);
    });

    test("shared imports", () => {
      const code = dedent`
        import { shared } from "./shared";
        export const chunk = shared("chunk");
        export const main = shared("main");
      `;
      expect(hasChunkableExport(code, "chunk", ...cache)).toBe(true);
      expect(hasChunkableExport(code, "main", ...cache)).toBe(true);
      expect(getChunkedExport(code, "chunk", {}, ...cache)?.code)
        .toMatchInlineSnapshot(`
        "import { shared } from "./shared";
        export const chunk = shared("chunk");"
      `);
      expect(getChunkedExport(code, "main", {}, ...cache)?.code)
        .toMatchInlineSnapshot(`
        "import { shared } from "./shared";
        export const main = shared("main");"
      `);
    });

    test("re-exports using shared statement", () => {
      const code = dedent`
        export { chunk1, chunk2, main } from "./shared";
      `;
      expect(hasChunkableExport(code, "chunk1", ...cache)).toBe(true);
      expect(hasChunkableExport(code, "chunk2", ...cache)).toBe(true);
      expect(hasChunkableExport(code, "main", ...cache)).toBe(true);
      expect(
        getChunkedExport(code, "chunk1", {}, ...cache)?.code
      ).toMatchInlineSnapshot(`"export { chunk1 } from "./shared";"`);
      expect(
        getChunkedExport(code, "chunk2", {}, ...cache)?.code
      ).toMatchInlineSnapshot(`"export { chunk2 } from "./shared";"`);
      expect(
        omitChunkedExports(code, ["chunk1", "chunk2"], {}, ...cache)?.code
      ).toMatchInlineSnapshot(`"export { main } from "./shared";"`);
    });

    test("aliased re-exports using shared statement", () => {
      const code = dedent`
        export {

Review comment (suggestion):
This is the core issue being fixed. In the original test case that mistakenly used `getChunkedExport` instead of `omitChunkedExports`, this import statement was missing.

Code after:
        export { chunk2 };"
      `);
      expect(omitChunkedExports(code, ["chunk1", "chunk2"], {}, ...cache)?.code)
        .toMatchInlineSnapshot(`
        "import { mainImport } from "./shared";
        const main = () => mainImport;
        export { main };"
      `);
    });

    test("shared imports", () => {
      const code = dedent`
        import { shared } from "./shared";
        export const chunk = shared("chunk");
        export const main = shared("main");
      `;
      expect(hasChunkableExport(code, "chunk", ...cache)).toBe(true);
      expect(hasChunkableExport(code, "main", ...cache)).toBe(true);
      expect(getChunkedExport(code, "chunk", {}, ...cache)?.code)
        .toMatchInlineSnapshot(`
        "import { shared } from "./shared";
        export const chunk = shared("chunk");"
      `);
      expect(omitChunkedExports(code, ["chunk"], {}, ...cache)?.code)
        .toMatchInlineSnapshot(`
        "import { shared } from "./shared";
        export const main = shared("main");"
      `);
    });

    test("shared imports across chunks but not main chunk", () => {
      const code = dedent`
        import { shared } from "./shared";
        export const chunk1 = shared("chunk1");
        export const chunk2 = shared("chunk2");
        export const main = "main";
      `;
      expect(hasChunkableExport(code, "chunk1", ...cache)).toBe(true);
      expect(hasChunkableExport(code, "chunk2", ...cache)).toBe(true);
      expect(hasChunkableExport(code, "main", ...cache)).toBe(true);
      expect(getChunkedExport(code, "chunk1", {}, ...cache)?.code)
        .toMatchInlineSnapshot(`
        "import { shared } from "./shared";
        export const chunk1 = shared("chunk1");"
      `);
      expect(getChunkedExport(code, "chunk2", {}, ...cache)?.code)
        .toMatchInlineSnapshot(`
        "import { shared } from "./shared";
        export const chunk2 = shared("chunk2");"
      `);
      expect(