-
Notifications
You must be signed in to change notification settings - Fork 150
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
Libraries not working with svelte-preprocess v6 #643
Comments
Please provide a proper reproduction in form of link to a repository on Github or Stackblitz |
@dummdidumm here is a minimal reproduction of my setup using Turborepo, bun and Astro with some Svelte components. There is some SCSS imports for global variables and functions as well as a local variables file. https://github.com/flayks/svelte-preprocess-v6 If you run
it is using the v6.0.1 (latest) of Now if you switch to the branch v5 and run the same exact code, it builds without any issue. This makes me think that Thank you for digging into this! |
Can you reduce this further and use node instead of Bun (I'm on windows)? I doubt that turborepo or bun have something to do with it. |
@dummdidumm No worries, I updated both branches to use pnpm instead Ha! that could potentially be something yes |
I can't reproduce this, I get a different one though: Please shrink down the reproduction further:
|
Hm, that's weird. I've pushed a branch 'nomonorepo' and it seems to build. Would that mean that it comes from the use of a monorepo? It's a pity because the whole purpose of this is to share Svelte configs through multiple apps ( |
I found it is occurring when If you'd like me to provide a simple example I can, but you can probably turn off Edit: we'll probably stick with 5.x for now so we don't have to refactor our whole app. It doesn't seem we're missing out on any features or benefits with 6.x. |
After trying this on another whole site and setup, I can assure that the issue comes from |
@jacwright this is noted in the list of breaking changes. It is required because there were previously two other options, both of which are deprecated/removed:
My guess is you were probably implicitly using the latter. As for the large app and the refactoring: It's "only" a matter of adding @flayks from what I can see your issue looks different though, so these are unrelated things. |
@dummdidumm yeah, I know. We can do it, but it is hundreds of files. And we have to do it over everything, not just Svelte files. [sigh] |
@jacwright yeah it's tedious for sure - wondering if there's a way to write a migration script for this. @flayks I finally got to the bottom of this. The sass error I mentioned was a red herring - it came from an unrelated Astro bug where configuration files are resolved from on Windows. When I fixed that locally I finally saw the error. Turns out it's in fact the same You can fix this by either adding a I'll also add additional logic to set |
In case no tsconfig is found whatsoever, enable `verbatimModuleSyntax` to prevent stripping unused imports. Also fix a related issue where the config passed manually was not properly parsed. Also print warning message in bold to make it more visible. related to #643
In case no tsconfig is found whatsoever, enable `verbatimModuleSyntax` to prevent stripping unused imports. Also fix a related issue where the config passed manually was not properly parsed. Also print warning message in bold to make it more visible. related to #643
Ha, great job @dummdidumm! Thanks for digging into this and finding the culprit. I updated to 6.0.2 and can actually build without any issue. I'll still do these changes though. |
@jacwright could you run |
Describe the bug
After upgrading to svelte-preprocess v6, I get into errors using libraries such as @portabletext/svelte where it just says that
PortableText is not defined
.Is it linked to the
PortableText
lib here orsvelte-preprocess
? The thing that bugs me is that it works perfectly fine with the v5, without changing any code or other dependencies. Just upgrading tosvelte-preprocess
v6 breaks it.Logs
To Reproduce
A bit trivial to reproduce using this specific example with Sanity and PortableText, but just using
5.1.4
vs6.0.1
breaks the build.Expected behavior
It should be normally without error
Information about your project:
svelte-preprocess
version 6.0.1The text was updated successfully, but these errors were encountered: