Replies: 6 comments 18 replies
-
Can you paste some links please? |
Beta Was this translation helpful? Give feedback.
-
I may have missed the discussion and @bluwy or @dominikg might know better than I do, but I don't recall Svelte needing to noExternalize linked dependencies? The thing I do remember being an issue was whether we would put just the package name or a glob as an option value. |
Beta Was this translation helpful? Give feedback.
-
One of the main reason linked deps are We also can't do this in build as it creates an inconsistency where Vite features work in dev, but doesn't work in build. For example, in dev the users are allowed to use raw TS files,
I think it should be fine if we document this. I agree that it can be confusing when debugging tooling/config. Ideally this ambiguity should be hidden for most users by default because we want the DX to come automatically without any configuration.
Given the reasons above, I think the pros of DX outweighs this. There are things in Vite like making
As @patak-dev and @benmccann pointed in another thread, the bug report (sveltejs/kit#5542) in SvelteKit isn't related to SvelteKit only (It should've been a Vite issue). The issue is that a user is exporting raw TypeScript in a monorepo package, and it used to work as it's |
Beta Was this translation helpful? Give feedback.
-
We just got bit by this unexpected behavior when upgrading from Vite 3.0.0 to Vite 3.0.8 (sveltejs/kit#5861). It cost hours of debugging to figure it out why our project was broken and would have taken much longer if I weren't already aware of this discussion. I think this is a very problematic feature as it assumes users are not using pnpm and quickly falls apart and breaks projects when dependencies have We've still not been able to fix the issue as the workaround is not working for us, but will continue to investigate |
Beta Was this translation helpful? Give feedback.
-
A lot of users are having issues with that. For example today, a high-tier sponsor is having major issues because its monorepo has a lot of CJS packages that use I told them to add each CJS package of their monorepo that uses
I've grown very confident that this proposal is the right move. But at least supporting @bluwy WDYT? |
Beta Was this translation helpful? Give feedback.
-
Hi! I'm late to the party but I have a question. I do use and really enjoy the feature of linked dependencies being "internalized". I develop an app that uses a ui component library which resides in a separate repo and it's very efficient to "npm link" it locally and be able to make changes to the ui library that reflect immediately. I also think it's ok to have that as default behavior, since imho in most cases a package is linked locally, that is the reasoning. BUT my problem is the other way round: When I now try to build the app in a different environment (e.g. a cd pipeline) where the package is loaded from npm and it's not linked, the build breaks because the code is externalized and thus not transpiled. My imports in the app now load the original Typescript code from the dependency. Is there an option to tell Vite to always noExternalize/internalize the package, no matter how it is provided? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Right now, by default, Vite noExternalizes dependencies that are linked.
Instead, I propose to externalize linked deps by default. The user can revert to the current behavior by adding the dependency to
ssr.noExternal
.Because:
Note that Vite
3.0.0
,3.0.1
,3.0.2
were actually implementing my proposal, which was reverted in3.0.3
. The interesting thing here is that only SvelteKit's development team complained about that change. This is a signal that not many people will miss the current behavior. With my proposed behavior, the SvelteKit's dev team can revert by addingvite-plugin-svelte
tossr.noExternal
while developing SvelteKit (I don't know but that's what I suspect SvelteKit is wanting).Note that, at the time I'm writing this,
3.0.0
,3.0.1
,3.0.2
is 260k downloads (total Vite downloads: 1.1M downloads). So that's a significant amount of users who didn't even realize the change. I would even say that it's likely that only the SvelteKit dev team would ever have noticed shall we have not reverted things in3.0.3
.CC @patak-dev @bluwy @benmccann.
Beta Was this translation helpful? Give feedback.
All reactions