Skip to content

Nuxt app hangs after build when using PGlite multi-tab worker with nuxt-security #668

@Us3r-gitHub

Description

@Us3r-gitHub

Environment

|                      |                                                                  |
| -------------------- | ---------------------------------------------------------------- |
| **Operating system** | `Linux 6.14.0-37-generic`                                        |
| **CPU**              | `Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 cores)`           |
| **Node.js version**  | `v25.2.1`                                                        |
| **nuxt/cli version** | `3.31.3`                                                         |
| **Package manager**  | `pnpm@10.24.0`                                                   |
| **Nuxt version**     | `4.2.2`                                                          |
| **Nitro version**    | `2.12.9`                                                         |
| **Builder**          | `vite@7.3.0`                                                     |
| **Config**           | `compatibilityDate`, `devtools`, `modules`, `security`, `vite`   |
| **Modules**          | `nuxt-security@2.5.0`                                            |

Nuxt Security Version

2.5.0

Default setup used?

No, the bug happens only when I set custom values for the security option

Security options

security: {
    headers: {
      contentSecurityPolicy: {
        "script-src": [
          "'self'",
          "https:",
          "'unsafe-inline'",
          "'strict-dynamic'",
          "'nonce-{{nonce}}'",
          "'wasm-unsafe-eval'", // <- Add this line to work with pglite
        ],
      },
    },
  },

Reproduction

👉 on branch (nuxt-security)

Description

  • What happens ?
    After running pnpm run build and pnpm run preview, the Nuxt application shows a blank screen and appears to hang.

  • What is expected to happen ?
    The application should start and render normally after build, the same as in dev mode.

Notes

Additional context

** Scenarios **

Scenario nuxt-security PGlite worker Dev (pnpm run dev) Build + Preview
1. Basic PGlite ✅ Works ✅ Works
2. PGlite multi-tab worker ✅ Works ❌ Hangs / blank screen
3. No nuxt-security ✅ Works ✅ Works

Related Commits


Screenshots

  • Scenario 1
Image
  • Scenario 2
Image
  • Scenario 3
Image

Logs

There are **no errors or logs** in the terminal or browser console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions