Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default export from commonjs dependency compiles differently in dev and prod builds #10696

Closed
DetachHead opened this issue Sep 8, 2023 · 1 comment
Labels

Comments

@DetachHead
Copy link

DetachHead commented Sep 8, 2023

Describe the bug

import { json } from "@sveltejs/kit";
import foo from "somepackage/index.js"; 
 
export const GET = () => {
  console.log(foo);
  return json(foo); 
};

when running vite dev it prints {a: 1}. when running vite build it prints { default: { a: 1 } }

Reproduction

https://github.com/DetachHead/sveltekit-issue/tree/d724513ed294e55a237241fb371e815ab3c9f923

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
    Memory: 1.81 GB / 15.92 GB
  Binaries:
    Node: 20.4.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.5.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 7.27.0 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Chrome: 116.0.5845.180
    Edge: Spartan (44.19041.1266.0), Chromium (116.0.1938.69)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.0
    @sveltejs/adapter-node: ^1.3.1 => 1.3.1
    @sveltejs/kit: ^1.20.4 => 1.24.1
    svelte: ^4.0.5 => 4.2.0
    vite: ^4.4.2 => 4.4.9

Severity

serious, but I can work around it

Additional Information

@benmccann benmccann added the vite label Oct 10, 2023
@benmccann
Copy link
Member

I'm going to close this since it's an issue in Vite and there's nothing we can do about it in SvelteKit. I think it will be fixed in Vite 5 as this sounds like vitejs/vite#14521

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants