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

Same problem as #13238 when using adapter-vercel #13273

Closed
thebjorn opened this issue Jan 4, 2025 · 3 comments · Fixed by #13291
Closed

Same problem as #13238 when using adapter-vercel #13273

thebjorn opened this issue Jan 4, 2025 · 3 comments · Fixed by #13291
Labels
bug Something isn't working

Comments

@thebjorn
Copy link

thebjorn commented Jan 4, 2025

Describe the bug

Hi again (I'm assuming you want me to file a new issue, let me know if I should have added to the last one...),

The fix for #13238 worked great for my sample repo, but unfortunately not for my production build. After a bit of searching I figured out that the error

If bundling, conditions should include development or production. If not bundling, conditions or NODE_ENV should include development or production. See https://www.npmjs.com/package/esm-env for tips on setting conditions in popular bundlers and runtimes.

reappears if you switch from adapter-auto to adapter-vercel.

--- a/package.json
+++ b/package.json
@@ -32,13 +32,14 @@
 	},
 	"devDependencies": {
 		"@sveltejs/adapter-auto": "^3.3.1",
-		"@sveltejs/kit": "^2.15.0",
+		"@sveltejs/adapter-vercel": "^5.5.2",
+		"@sveltejs/kit": "^2.15.1",
...

and

--- a/svelte.config.js
+++ b/svelte.config.js
@@ -1,4 +1,5 @@
-import adapter from '@sveltejs/adapter-auto';
+// import adapter from '@sveltejs/adapter-auto';
+import adapter from '@sveltejs/adapter-vercel';
 import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
...

I have updated the sample repo: https://github.com/thebjorn/sk-sync-bug

Do you want me to file a new issue or do you prefer to re-open this one?

Reproduction

See #13238 with the added diffs from above.

Logs

srv/work/sk-sync-bug❱ pnpm check                                                                                                                                                                                         

> sk-sync-bug@0.0.1 check C:\srv\work\sk-sync-bug
> svelte-kit sync && svelte-check --tsconfig ./tsconfig.json

If bundling, conditions should include development or production. If not bundling, conditions or NODE_ENV should include development or production. See https://www.npmjs.com/package/esm-env for tips on setting conditions in popular bundlers and runtimes.

====================================
Loading svelte-check in workspace: c:\srv\work\sk-sync-bug
Getting Svelte diagnostics...

If bundling, conditions should include development or production. If not bundling, conditions or NODE_ENV should include development or production. See https://www.npmjs.com/package/esm-env for tips on setting conditions in popular bundlers and runtimes.
====================================
svelte-check found 0 errors and 0 warnings

srv/work/sk-sync-bug❱

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (48) x64 AMD Ryzen Threadripper 3960X 24-Core Processor 
    Memory: 41.83 GB / 63.88 GB
  Binaries:
    Node: 22.12.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.15.1 - ~\AppData\Local\pnpm\pnpm.CMD
    bun: 1.1.41 - ~\AppData\Roaming\npm\bun.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @sveltejs/adapter-auto: ^3.3.1 => 3.3.1
    @sveltejs/adapter-vercel: ^5.5.2 => 5.5.2
    @sveltejs/kit: ^2.15.1 => 2.15.1
    @sveltejs/package: ^2.3.7 => 2.3.7
    @sveltejs/vite-plugin-svelte: ^5.0.3 => 5.0.3
    svelte: ^5.16.1 => 5.16.1
    vite: ^6.0.7 => 6.0.7

Severity

annoyance

Additional Information

No response

@eltigerchino
Copy link
Member

eltigerchino commented Jan 6, 2025

This happens because the Vercel adapter imports the VERSION variable from the SvelteKit package which imports from esm-env.

import { BROWSER, DEV } from 'esm-env';
export { VERSION } from '../version.js';

Don't think we can apply the same fix as #13244 since we need the DEV variable for the other helpers in the file.
cc: @benmccann

@eltigerchino eltigerchino added the bug Something isn't working label Jan 6, 2025
@thebjorn
Copy link
Author

thebjorn commented Jan 6, 2025

It's not the easiest problem to isolate... maybe having a --verbose flag to svelte-kit sync would help finding where it originates...

@benmccann
Copy link
Member

I think I'll just release a new version of esm-env without the warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants