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

delete operator not working as excepted #6747

Open
lnoss opened this issue Oct 27, 2023 · 6 comments
Open

delete operator not working as excepted #6747

lnoss opened this issue Oct 27, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@lnoss
Copy link

lnoss commented Oct 27, 2023

What version of Bun is running?

1.0.7

What platform is your computer?

Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

  1. Initialize a Nuxt app: bun x nuxi init my-nuxt-app
  2. Integrate NuxtUI bun add @nuxt/ui (the module also installs @nuxtjs/tailwindcss and @nuxtjs/color-mode)
  3. In nuxt.config.ts at root project level, add:
export default defineNuxtConfig({
  modules: ['@nuxt/ui']
})
  1. Start the dev server with Bun runtime (bun --bun run dev) and compare it with Node runtime (bun run dev)

What is the expected behavior?

$ nuxt dev
Nuxt 3.8.0 with Nitro 2.7.1

  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

ℹ Using default Tailwind CSS file
  ➜ DevTools: press Shift + Alt + D in the browser (v1.0.0)

ℹ Tailwind Viewer: http:/localhost:3000/_tailwind/
ℹ Vite client warmed up in 3230ms
✔ Nitro built in 658 ms

What do you see instead?

$ nuxt dev
Nuxt 3.8.0 with Nitro 2.7.1

  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

 WARN

 WARN  warn - As of Tailwind CSS v2.2, lightBlue has been renamed to sky. 

 WARN  warn - Update your configuration file to silence this warning.

 WARN

 WARN  warn - As of Tailwind CSS v3.0, warmGray has been renamed to stone.

 WARN  warn - Update your configuration file to silence this warning.

 WARN

 WARN  warn - As of Tailwind CSS v3.0, trueGray has been renamed to neutral.

 WARN  warn - Update your configuration file to silence this warning.

 WARN

 WARN  warn - As of Tailwind CSS v3.0, coolGray has been renamed to gray.

 WARN  warn - Update your configuration file to silence this warning.

 WARN

 WARN  warn - As of Tailwind CSS v3.0, blueGray has been renamed to slate.

 WARN  warn - Update your configuration file to silence this warning.

ℹ Using default Tailwind CSS file
  ➜ DevTools: press Shift + Alt + D in the browser (v1.0.0)

ℹ Tailwind Viewer: http:/localhost:3000/_tailwind/
✔ Nitro built in 451 ms
ℹ Vite client warmed up in 3413ms

Additional information

See original post by @Daynil in tailwindlabs/tailwindcss#4690 (comment)

Tailwind has deprecated several color names and renamed them, but has left the deprecated names in the colors object for backwards compatibility. These deprecated colors will presumably be removed in a future version, at which point the warning will not show up.

In the meantime, if you need to spread the full default color object into your theme.colors and want to suppress the warning, just delete the deprecated colors after importing.

NuxtUI delete these references and the solution works with Node, but not with Bun. Lines concerned: https://github.com/nuxt/ui/blob/4ce23746da27ad0ef9b1833e41105165045f1cb8/src/module.ts#L13#L17

I thought it was a problem of weak/strong references or more generally with garbage collector implementation, but @Jarred-Sumner thinks that the root cause is something linked to some property set to readonly and delete is not throwing an error maybe due to some sloppy mode thing. Or something is marked as enumerable (& vice versa).

Fixing this issue should close nuxt/ui#809.

@lnoss lnoss added the bug Something isn't working label Oct 27, 2023
@thunfisch987
Copy link
Contributor

i'm not sure if this could lead to more serious bugs than this, but it should still be looked into

@thunfisch987
Copy link
Contributor

any updates on this?

@pi0
Copy link

pi0 commented Feb 1, 2024

Please see the workaround here: nuxt/ui#809 (comment)

// https://github.com/oven-sh/bun/issues/6747
import { createRequire } from 'node:module'
const _require = createRequire(import.meta.url)
const defaultColors = _require('tailwindcss/colors.js')
delete defaultColors.lightBlue
delete defaultColors.warmGray
delete defaultColors.trueGray
delete defaultColors.coolGray
delete defaultColors.blueGray

I tried to make a more minimal reproduction but it seems it can only happen in complex mixed CJS/ESM scenarios. (due to how it is an edge-case, probably would make sense we fix it in nuxt/ui workaround unless there are more reports without nuxt or nuxt/ui...)

@wottpal
Copy link

wottpal commented Sep 26, 2024

any updates? seems to be the only remaining thing that behaves weirdly after going all-in on bun

@simaotwx
Copy link

Weirdly, I don't get this on my host (Bun 1.1.34, Arch Linux), but I do get it in the docker image oven/bun (also 1.1.34)

@Ant59
Copy link

Ant59 commented Jan 21, 2025

Weirdly, I don't get this on my host (Bun 1.1.34, Arch Linux), but I do get it in the docker image oven/bun (also 1.1.34)

Are you using the --bun flag locally, or allowing Bun to use the Node binary to run scripts? That might explain why the container (which has no Node binary) produces a different result.

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

No branches or pull requests

6 participants