-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Warn when browser
or dev
are used
#8033
Comments
Please notice @benmccann that there is a problem with the REPL, I filled up an issue: benmccann/esm-env#1 |
We should move forward with this change regardless. Using |
Hi, can you have a look at https://github.com/Tal500/esm-env-robust and confirm it's a valid workaround for the expected behavior? |
Would really love to use the alternative — use |
Should be able to close this now kit/packages/package/src/validate.js Line 46 in 7243694
|
Describe the problem
People use
import { browser, dev } from '$app/environment'
and then their packages end up being tied to SvelteKit and Vite when they should work with any Svelte projectDescribe the proposed solution
Print a big loud warning when running svelte-package if anyone tries to use
import.meta.env.SSR
,import { browser, dev } from '$app/environment'
, etc. and tell them to useimport { BROWSER, DEV } from 'esm-env'
unless they intend for their package to only be used in SvelteKitPut a warning in the docs not to use these for libraries
Alternatives considered
Get rid of
import { browser, dev } from '$app/environment'
and just tell people to useesm-env
in the docs. I think I'd prefer that honestly, but it couldn't be done until SvelteKit 2 as it's a breaking changeImportance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: