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

NextJS 12.3.x doesn't remove FOUC style (body hidden) #41476

Closed
1 task done
OnkelTem opened this issue Oct 17, 2022 · 4 comments · Fixed by #41484
Closed
1 task done

NextJS 12.3.x doesn't remove FOUC style (body hidden) #41476

OnkelTem opened this issue Oct 17, 2022 · 4 comments · Fixed by #41484
Labels
Webpack Related to Webpack with Next.js.

Comments

@OnkelTem
Copy link

OnkelTem commented Oct 17, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #56-Ubuntu SMP Tue Sep 20 13:23:26 UTC 2022
    Binaries:
      Node: 16.17.0
      npm: 8.15.0
      Yarn: 1.22.19
      pnpm: N/A
    Relevant packages:
      next: 12.3.2-canary.29
      eslint-config-next: 12.3.1
      react: 18.2.0
      react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

NextJS in dev mode adds this markup to the html head:

<style data-next-hide-fouc="true">body{display:none}</style>
<noscript data-next-hide-fouc="true">
  <style>body{display:block}</style>
</noscript>

As a result the page is not displayed.

Expected Behavior

It should remove this FOUC protection, or what is its name.

Link to reproduction

https://github.com/OnkelTem/demo-styled-jsx

To Reproduce

To reproduce with the referenced repository:

$ npm run dev

OR to reproduce from scratch:

$ npx create-next-app@latest --ts demo-styled-jsx
$ cd demo-styled-jsx
$ npm run dev

THEN open the page in your browser.

@OnkelTem OnkelTem added the bug Issue was opened via the bug report template. label Oct 17, 2022
@awareness481
Copy link
Contributor

Can reproduce, getting the following error in the console

Uncaught ReferenceError: exports is not defined
    at eval (react-refresh-runtime.development.js?7e84:645:1)
    at eval (react-refresh-runtime.development.js?7e84:657:3)
    at ./node_modules/next/dist/compiled/react-refresh/cjs/react-refresh-runtime.development.js (react-refresh.js?ts=1666001933146:41:1)
    at options.factory (webpack.js?ts=1666001933146:667:31)
    at __webpack_require__ (webpack.js?ts=1666001933146:37:33)
    at fn (webpack.js?ts=1666001933146:322:21)
    at eval (runtime.js?9c6e:6:3)
    at ./node_modules/next/dist/compiled/react-refresh/runtime.js (react-refresh.js?ts=1666001933146:52:1)
    at options.factory (webpack.js?ts=1666001933146:667:31)
    at __webpack_require__ (webpack.js?ts=1666001933146:37:33)

@OnkelTem
Copy link
Author

OnkelTem commented Oct 17, 2022

I noticed that what triggers this error is the project directory name. The pattern is: /styed-jsx$/ f.e.:

styled-jsx/
foobar-styled-jsx/

Maybe this fact should be added to the report title.

@balazsorban44 balazsorban44 added kind: bug Webpack Related to Webpack with Next.js. and removed bug Issue was opened via the bug report template. labels Oct 17, 2022
@balazsorban44
Copy link
Member

This seems to have been introduced in #40679

@kodiakhq kodiakhq bot closed this as completed in #41484 Oct 19, 2022
kodiakhq bot pushed a commit that referenced this issue Oct 19, 2022
)

Fixes #41476, ref #40679

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
Kikobeats pushed a commit to Kikobeats/next.js that referenced this issue Oct 24, 2022
…cel#41484)

Fixes vercel#41476, ref vercel#40679

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Webpack Related to Webpack with Next.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants