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

[bug]: Paradoxical bug with using withUt or the style itself #975

Closed
2 tasks done
cliffordkleinsr opened this issue Sep 23, 2024 · 9 comments
Closed
2 tasks done
Labels
area:packages issue regarding one of the uploadthing packages bug: low priority something isn't working as it should, but it's not critical to the core functionality workaround available solution exists for the issue using existing functionality, although it may not be optimized for DX

Comments

@cliffordkleinsr
Copy link

cliffordkleinsr commented Sep 23, 2024

Provide environment information

System:
    OS: Windows 11 Pro 23H2
    CPU: AMD Ryzen 7 5700G with Radeon Graphics @ 3.80 GHz
    Memory: 16.0 GB (15.9 GB usable)
    GPU: NVIDIA GTX RTX 4080

  Binaries:
    Node: v20.15.0
    Bun: 1.1.26 
    npm: 10.7.0 

  Browsers:
    Brave Browser: 119.1.60.110
    Chrome: 128.0.6613.139 (Official Build) (64-bit)
    Edge: 128.0.2739.67
    Safari: 17.6
  npm packages:
    "@uploadthing/svelte": "^7.0.2"
    "typescript": "^5.0.0",
    "vite": "^5.0.3"
    "svelte": "^4.2.7",
    "@sveltejs/kit": "^2.5.26",
    "uploadthing": "^7.0.2",

Describe the bug

Using withUt breaks the upload button whereas using the @uploadthing/svelte/styles.css stylesheet by itself without including the withUT utility breaks the navbar.

WithUT does not show any loading state when I begin uploading as shown below:
image

Using the @uploadthing/svelte/styles.css stylesheet import before my global.css breaks my navbar as shown below
image
which should look like:
image

Note Im only using withUt and the style by itself when testing this behavior

Link to reproduction

N/A

To reproduce

Add the withUT utility or the styles to a fresh Sveltekit installation with tailwind installed. But Not Both!

Additional information

I have tried clearing my bun.lockb and node-modules directory and reinstalling the packages. None resolves the issue specifically on deployment to either Vercel or my personal VPS. The stylesheet inclusion works on the dev server however breaks the styles and the navbar on deployment

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR fixing this bug!

Code of Conduct

  • I agree to follow this project's Code of Conduct
@cliffordkleinsr cliffordkleinsr added area:packages issue regarding one of the uploadthing packages 🐛 bug: unconfirmed labels Sep 23, 2024
@juliusmarminge
Copy link
Collaborator

juliusmarminge commented Sep 23, 2024

is your repo a monorepo? if you log the outputted tailwind config, do any uploadthing paths get added to content? I've run into edge cases where the paths cannot be auto-found. If so you can add the path to @uploadthing/svelte/dist/** to the content array yourself

const config = withUt({
  // your config
})

console.log(config) // does this have `content: ["/path/to/node_modules/@uploadthing/svelte/dist/**"]`

export default config

@cliffordkleinsr
Copy link
Author

This is what the console logs:

{
  darkMode: [ 'class' ],
  content: [ './src/**/*.{html,js,svelte,ts}' ],
  safelist: [ 'dark' ],
  theme: {
    container: { center: true, padding: '2rem', screens: [Object] },
    extend: { colors: [Object], borderRadius: [Object], fontFamily: [Object] }
  },
  plugins: [
    [Function: optionsFunction] {
      __isOptionsFunction: true,
      __pluginFunction: [Function (anonymous)],
      __configFunction: [Function (anonymous)]
    },
    { handler: [Function (anonymous)], config: undefined }
  ]
}

@juliusmarminge
Copy link
Collaborator

juliusmarminge commented Sep 24, 2024

Is your repo a monorepo?

? Also, What PM are you using?

It's hard to auto-detect the paths in all scenarios. Sometimes require.resolve("@uploadthing/svelte") doesn't resolve to anything resulting in no content src being added. In these cases you can do it yourself with a hardcoded path.

@cliffordkleinsr
Copy link
Author

cliffordkleinsr commented Sep 24, 2024

monorepo

Yes, it's a mono repo. Where should I add the required resolve tag

@juliusmarminge
Copy link
Collaborator

Are you able to provide a reproduction? Without that, the only advise I can give is to manually add the content paths

export default withUt({
  // your config
  content: [
    './src/**/*.{html,js,svelte,ts}',
    './node_modules/@uploadthing/svelte/dist/**',
    '../../node_modules/@uploadthing/svelte/dist/**', // or .. back to root, depending on where your package manager keeps the uploadthing distribution
  ]
})

@cliffordkleinsr
Copy link
Author

Doing it manually works. repro would be hard as its a very large project

@juliusmarminge
Copy link
Collaborator

No worries I managed to reproduce it in the solid example: 1d23a77#diff-c91c28746f5b2978ef621d788f91af58b065126119189296cd628141787aa8cd

Guess it's something odd with Vite cause if i require.resolve("@uploadthing/solid") in the tailwind config file it finds the path, but the same line of code executed from uploadthing/tw doesn't resolve the path...

Will investigate further, but hardcoded paths is a valid workaround for now

@juliusmarminge juliusmarminge added bug: low priority something isn't working as it should, but it's not critical to the core functionality workaround available solution exists for the issue using existing functionality, although it may not be optimized for DX and removed 🐛 bug: unconfirmed labels Sep 24, 2024
@cliffordkleinsr
Copy link
Author

Many thanks again @juliusmarminge

@juliusmarminge
Copy link
Collaborator

Fixed in #987. Will be released in the next patch update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:packages issue regarding one of the uploadthing packages bug: low priority something isn't working as it should, but it's not critical to the core functionality workaround available solution exists for the issue using existing functionality, although it may not be optimized for DX
Projects
None yet
Development

No branches or pull requests

2 participants