Repository: next.js
Issue: CSP nonce being added to inline scripts on `next dev` but not on `next build & next start`
Labels: examples

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.1.0: Mon Oct  9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000
Binaries:
  Node: 20.8.1
  npm: 10.2.4
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 14.0.4-canary.25
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A
```


### Which example does this report relate to?

https://nextjs.org/docs/pages/building-your-application/configuring/content-security-policy

### What browser are you using? (if relevant)

Chrome Version 119.0.6045.159 (Official Build) (arm64)

### How are you deploying your application? (if relevant)

next build & next start

### Describe the Bug

Hi,
I Implemented the middleware exactly as mentioned in the documentation (few changes in headers according to my company).
Buy running the app with `next dev` I can see that all inline scripts on my page got the attribute `nonce` with a value.
However, the same does not happen when i run `next build & next start`, i know in this case the `nonce` attribute should be shown without any value (chrome hides it), but in my case the `nonce` attribute not appear at all.

run the app with `next dev` command.
```
<head>
        <meta charSet="utf-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <link rel="stylesheet" href="/mpa/_next/static/css/app/layout.css?v=1701242783101" data-precedence="next_static/css/app/layout.css"/>
        <link rel="preload" as="script" fetchPriority="low" nonce="NzMyNjMyZmYtOTQ1MC00NDE1LThkN2UtMTcwNTAxZTY3NGU0" href="/mpa/_next/static/chunks/webpack.js?v=1701242783101"/>
        <script src="/mpa/_next/static/chunks/main-app.js?v=1701242783101" async="" nonce="NzMyNjMyZmYtOTQ1MC00NDE1LThkN2UtMTcwNTAxZTY3NGU0"></script>
        <script src="/mpa/_next/static/chunks/app-pages-internals.js" async="" nonce="NzMyNjMyZmYtOTQ1MC00NDE1LThkN2UtMTcwNTAxZTY3NGU0"></script>
        <script src="/mpa/_next/static/chunks/app/page.js" async="" nonce="NzMyNjMyZmYtOTQ1MC00NDE1LThkN2UtMTcwNTAxZTY3NGU0"></script>
        <script src="/mpa/_next/static/chunks/app/layout.js" async="" nonce="NzMyNjMyZmYtOTQ1MC00NDE1LThkN2UtMTcwNTAxZTY3NGU0"></script>
        <title>HCU</title>
        <link rel="icon" href="/mpa/favicon.ico" type="image/x-icon" sizes="192x192"/>
        <script src="/mpa/_next/static/chunks/polyfills.js" noModule="" nonce="NzMyNjMyZmYtOTQ1MC00NDE1LThkN2UtMTcwNTAxZTY3NGU0"></script>
    </head>
```

run the app with `next build` and `next start`

```
<head>
        <meta charSet="utf-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <link rel="stylesheet" href="/mpa/_next/static/css/44d83526643d7f06.css" crossorigin="" data-precedence="next"/>
        <link rel="preload" as="script" fetchPriority="low" href="/mpa/_next/static/chunks/webpack-3d59e6430b82682b.js" crossorigin=""/>
        <script src="/mpa/_next/static/chunks/fd9d1056-18b181602163d226.js" async="" crossorigin=""></script>
        <script src="/mpa/_next/static/chunks/472-2cfd35dc71ab9d5b.js" async="" crossorigin=""></script>
        <script src="/mpa/_next/static/chunks/main-app-703e8bd9ded479e2.js" async="" crossorigin=""></script>
        <script src="/mpa/_next/static/chunks/0db0ade4-d281d1d1c1dddaf3.js" async=""></script>
        <script src="/mpa/_next/static/chunks/753-728b6b2b2c57e761.js" async=""></script>
        <script src="/mpa/_next/static/chunks/app/page-02e6a714554046f0.js" async=""></script>
        <script src="/mpa/_next/static/chunks/app/layout-86ba9729fc0dee41.js" async=""></script>
        <title>HCU</title>
        <link rel="icon" href="/mpa/favicon.ico" type="image/x-icon" sizes="192x192"/>
        <script src="/mpa/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js" crossorigin="" noModule=""></script>
    </head>
```

this cause for csp errors:
![2023-11-29_09-48-52 (3)](https://github.com/vercel/next.js/assets/17119146/c92e459b-a2e5-490c-927e-3a36d2ce4b00)


### Expected Behavior

`next build & next start` should have a `nonce` attribute inside each script tag, the same as when running `next dev`.

### To Reproduce

i can't share my code due to company policy.

create new project, run it locally on your machine with `next dev`, a `nonce` attribute will show inside each script tag.

now run `next build` and `next start`, the `none` attribute not exist.