next-sass: Flash of unstyled content only when building for productionwebpack's sass-loader do not find foundation scss file without underline prefixWebpack is not compiling/including my scss files in developmentWebpack scss & css modules react - unexpected token stringNext.js: Webpack ExtractTextPlugin not extracting scss in nodes_modules with next-sassNext.js - import css file does not workGenerating a webfont and it's styles using webpack & sassreact + webpack + “sass,css,style” - loader doesn't work with css transitions groupHow to use next-css in next.config.js in combination with custom server Express“ReactBingmaps” does not work with next - css file/module from node_modules is not supportedI get internal server error while running next js app with styled component

Why using a variable as index of a list-item does not retrieve that item with clist_item:Nn?

Can the word crowd refer to just 10 people?

Windows reverting changes made by Linux to FAT32 partion

Parse a C++14 integer literal

Why does a table with a defined constant in its index compute 10X slower?

How can I monitor the bulk API limit?

Appropriate liquid/solvent for life in my underground environment on Venus

Would a "ring language" be possible?

How to laser-level close to a surface

Using `printf` to print variable containing `%` percent sign results in "bash: printf: `p': invalid format character"

What color to choose as "danger" if the main color of my app is red

Why do academics prefer Mac/Linux?

How many Dothraki are left as of Game of Thrones S8E5?

Hotel booking: Why is Agoda much cheaper than booking.com?

Why aren't satellites disintegrated even though they orbit earth within earth's Roche Limits?

Will this series of events work to drown a tarrasque?

How would fantasy dwarves exist, realistically?

Largest memory peripheral for Sinclair ZX81?

How does this piece of code determine array size without using sizeof( )?

Former Employer just sent me an IP Agreement

Why is choosing a suitable thermodynamic potential important?

Can an airline pilot be prosecuted for killing an unruly passenger who could not be physically restrained?

Why are there five extra turns in tournament Magic?

RegEx with d doesn’t work in if-else statement with [[



next-sass: Flash of unstyled content only when building for production


webpack's sass-loader do not find foundation scss file without underline prefixWebpack is not compiling/including my scss files in developmentWebpack scss & css modules react - unexpected token stringNext.js: Webpack ExtractTextPlugin not extracting scss in nodes_modules with next-sassNext.js - import css file does not workGenerating a webfont and it's styles using webpack & sassreact + webpack + “sass,css,style” - loader doesn't work with css transitions groupHow to use next-css in next.config.js in combination with custom server Express“ReactBingmaps” does not work with next - css file/module from node_modules is not supportedI get internal server error while running next js app with styled component






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








3















✅ Solved, see my reply below!



I'm using Next.js with next-sass. I've been struggling with a flash of unstyled content "FOUC" issue my entire day, testing various solutions I found online, but none seemed to work for me. The issue is especially visible when using CSS transitions, as the components will be visible without any styles and then transition to their CSS style.



This is only visible when building for production using next build and then next start. In development mode, using next, there is no FOUC issue.



Minimal example:



// next.config.js
const withSass = require('@zeit/next-sass');
module.exports = withSass();


// scss/style.scss
body
background-color: red;
transition: 2s all ease;



// pages/index.js
import React from "react";
import "../scss/style.scss";

const Home = () => (
<div>Test</div>
);

export default Home;


GitHub repo: https://github.com/jesperlindstrom/next-sass-fouc/



Video of problem: https://drive.google.com/file/d/12yukgmgsuPKRs0TD2yYZK9F7fBC7oSkF/view?usp=sharing



What am I doing wrong? Thanks!










share|improve this question
























  • I can't reproduce your probem put a github repo please

    – evgeni fotia
    Mar 24 at 8:14











  • @evgenifotia thanks for checking it out. I added a GitHub repo and a video clip just now.

    – Jesper Lindström
    Mar 24 at 9:03

















3















✅ Solved, see my reply below!



I'm using Next.js with next-sass. I've been struggling with a flash of unstyled content "FOUC" issue my entire day, testing various solutions I found online, but none seemed to work for me. The issue is especially visible when using CSS transitions, as the components will be visible without any styles and then transition to their CSS style.



This is only visible when building for production using next build and then next start. In development mode, using next, there is no FOUC issue.



Minimal example:



// next.config.js
const withSass = require('@zeit/next-sass');
module.exports = withSass();


// scss/style.scss
body
background-color: red;
transition: 2s all ease;



// pages/index.js
import React from "react";
import "../scss/style.scss";

const Home = () => (
<div>Test</div>
);

export default Home;


GitHub repo: https://github.com/jesperlindstrom/next-sass-fouc/



Video of problem: https://drive.google.com/file/d/12yukgmgsuPKRs0TD2yYZK9F7fBC7oSkF/view?usp=sharing



What am I doing wrong? Thanks!










share|improve this question
























  • I can't reproduce your probem put a github repo please

    – evgeni fotia
    Mar 24 at 8:14











  • @evgenifotia thanks for checking it out. I added a GitHub repo and a video clip just now.

    – Jesper Lindström
    Mar 24 at 9:03













3












3








3








✅ Solved, see my reply below!



I'm using Next.js with next-sass. I've been struggling with a flash of unstyled content "FOUC" issue my entire day, testing various solutions I found online, but none seemed to work for me. The issue is especially visible when using CSS transitions, as the components will be visible without any styles and then transition to their CSS style.



This is only visible when building for production using next build and then next start. In development mode, using next, there is no FOUC issue.



Minimal example:



// next.config.js
const withSass = require('@zeit/next-sass');
module.exports = withSass();


// scss/style.scss
body
background-color: red;
transition: 2s all ease;



// pages/index.js
import React from "react";
import "../scss/style.scss";

const Home = () => (
<div>Test</div>
);

export default Home;


GitHub repo: https://github.com/jesperlindstrom/next-sass-fouc/



Video of problem: https://drive.google.com/file/d/12yukgmgsuPKRs0TD2yYZK9F7fBC7oSkF/view?usp=sharing



What am I doing wrong? Thanks!










share|improve this question
















✅ Solved, see my reply below!



I'm using Next.js with next-sass. I've been struggling with a flash of unstyled content "FOUC" issue my entire day, testing various solutions I found online, but none seemed to work for me. The issue is especially visible when using CSS transitions, as the components will be visible without any styles and then transition to their CSS style.



This is only visible when building for production using next build and then next start. In development mode, using next, there is no FOUC issue.



Minimal example:



// next.config.js
const withSass = require('@zeit/next-sass');
module.exports = withSass();


// scss/style.scss
body
background-color: red;
transition: 2s all ease;



// pages/index.js
import React from "react";
import "../scss/style.scss";

const Home = () => (
<div>Test</div>
);

export default Home;


GitHub repo: https://github.com/jesperlindstrom/next-sass-fouc/



Video of problem: https://drive.google.com/file/d/12yukgmgsuPKRs0TD2yYZK9F7fBC7oSkF/view?usp=sharing



What am I doing wrong? Thanks!







webpack next.js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 12:48







Jesper Lindström

















asked Mar 23 at 17:06









Jesper LindströmJesper Lindström

40439




40439












  • I can't reproduce your probem put a github repo please

    – evgeni fotia
    Mar 24 at 8:14











  • @evgenifotia thanks for checking it out. I added a GitHub repo and a video clip just now.

    – Jesper Lindström
    Mar 24 at 9:03

















  • I can't reproduce your probem put a github repo please

    – evgeni fotia
    Mar 24 at 8:14











  • @evgenifotia thanks for checking it out. I added a GitHub repo and a video clip just now.

    – Jesper Lindström
    Mar 24 at 9:03
















I can't reproduce your probem put a github repo please

– evgeni fotia
Mar 24 at 8:14





I can't reproduce your probem put a github repo please

– evgeni fotia
Mar 24 at 8:14













@evgenifotia thanks for checking it out. I added a GitHub repo and a video clip just now.

– Jesper Lindström
Mar 24 at 9:03





@evgenifotia thanks for checking it out. I added a GitHub repo and a video clip just now.

– Jesper Lindström
Mar 24 at 9:03












1 Answer
1






active

oldest

votes


















0














So... the issue turns out to be a browser bug, not related to Next or Webpack at all. Managed to replicate with ordinary CSS and HTML, where transitions are fired on load. The solution sounds very stupid but solves it: import an empty .js file in your . I'm guesing it makes both the resources "blocking" and therefore waits for first render...



If anyone has the same issue in Next.js, I added this to my _document.js:



<Head>
...
<script src="/static/chrome-fix.js" />
</Head>


...and put chrome-fix.js as an empty file in my /static.



More info: https://bugs.chromium.org/p/chromium/issues/detail?id=332189






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55316262%2fnext-sass-flash-of-unstyled-content-only-when-building-for-production%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    So... the issue turns out to be a browser bug, not related to Next or Webpack at all. Managed to replicate with ordinary CSS and HTML, where transitions are fired on load. The solution sounds very stupid but solves it: import an empty .js file in your . I'm guesing it makes both the resources "blocking" and therefore waits for first render...



    If anyone has the same issue in Next.js, I added this to my _document.js:



    <Head>
    ...
    <script src="/static/chrome-fix.js" />
    </Head>


    ...and put chrome-fix.js as an empty file in my /static.



    More info: https://bugs.chromium.org/p/chromium/issues/detail?id=332189






    share|improve this answer



























      0














      So... the issue turns out to be a browser bug, not related to Next or Webpack at all. Managed to replicate with ordinary CSS and HTML, where transitions are fired on load. The solution sounds very stupid but solves it: import an empty .js file in your . I'm guesing it makes both the resources "blocking" and therefore waits for first render...



      If anyone has the same issue in Next.js, I added this to my _document.js:



      <Head>
      ...
      <script src="/static/chrome-fix.js" />
      </Head>


      ...and put chrome-fix.js as an empty file in my /static.



      More info: https://bugs.chromium.org/p/chromium/issues/detail?id=332189






      share|improve this answer

























        0












        0








        0







        So... the issue turns out to be a browser bug, not related to Next or Webpack at all. Managed to replicate with ordinary CSS and HTML, where transitions are fired on load. The solution sounds very stupid but solves it: import an empty .js file in your . I'm guesing it makes both the resources "blocking" and therefore waits for first render...



        If anyone has the same issue in Next.js, I added this to my _document.js:



        <Head>
        ...
        <script src="/static/chrome-fix.js" />
        </Head>


        ...and put chrome-fix.js as an empty file in my /static.



        More info: https://bugs.chromium.org/p/chromium/issues/detail?id=332189






        share|improve this answer













        So... the issue turns out to be a browser bug, not related to Next or Webpack at all. Managed to replicate with ordinary CSS and HTML, where transitions are fired on load. The solution sounds very stupid but solves it: import an empty .js file in your . I'm guesing it makes both the resources "blocking" and therefore waits for first render...



        If anyone has the same issue in Next.js, I added this to my _document.js:



        <Head>
        ...
        <script src="/static/chrome-fix.js" />
        </Head>


        ...and put chrome-fix.js as an empty file in my /static.



        More info: https://bugs.chromium.org/p/chromium/issues/detail?id=332189







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 24 at 12:46









        Jesper LindströmJesper Lindström

        40439




        40439





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55316262%2fnext-sass-flash-of-unstyled-content-only-when-building-for-production%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해