Create-react-app SASS source maps not working





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







1















SASS source map fails to output on create-react-app 2 (reported bug), been trying to find a workaround to this while an official fix is being considered.



Another user suggested adding the below to scripts:



"scripts": {
"build-css": "node-sass --source-map true --include-path ./src --include-path ./node_modules src/assets/sass -o public/css",
"watch-css": "npm run build-css && node-sass --source-map true --include-path ./src --include-path ./node_modules src/assets/sass -o public/css --watch --recursive"


This does the trick but generating another CSS which would get picked up outside of webpack, also breaking CSS injection (hot loading).



This is how the CSS is being included (via import on the index.js file). Ideally this should remain as is.



import "styles/main.scss";


Below the package.json (react-scripts v2.1.1):



"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"lint": "NODE_ENV=production eslint src --ext '.js,.jsx'",
"lint-fix": "yarn lint --fix",
"lint-check": "NODE_ENV=production eslint --print-config . | eslint-config-prettier-check",
"prepare-mobile": "node prepare-mobile.js",
"release-mobile": "node prepare-mobile-release.js",
"postbuild": "yarn prepare-mobile",
"precommit": "pretty-quick --staged"
}


Is there any way to output the SASS source map other than the above approach and without having to eject webpack?










share|improve this question

























  • Read about agairing's temporary fix for Firefox in github.com/facebook/create-react-app/issues/5707. You can also see the code changes here: github.com/facebook/create-react-app/pull/6472/commits/…. I can confirm this worked for me. I hope it helps!

    – trig
    Feb 26 at 17:23


















1















SASS source map fails to output on create-react-app 2 (reported bug), been trying to find a workaround to this while an official fix is being considered.



Another user suggested adding the below to scripts:



"scripts": {
"build-css": "node-sass --source-map true --include-path ./src --include-path ./node_modules src/assets/sass -o public/css",
"watch-css": "npm run build-css && node-sass --source-map true --include-path ./src --include-path ./node_modules src/assets/sass -o public/css --watch --recursive"


This does the trick but generating another CSS which would get picked up outside of webpack, also breaking CSS injection (hot loading).



This is how the CSS is being included (via import on the index.js file). Ideally this should remain as is.



import "styles/main.scss";


Below the package.json (react-scripts v2.1.1):



"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"lint": "NODE_ENV=production eslint src --ext '.js,.jsx'",
"lint-fix": "yarn lint --fix",
"lint-check": "NODE_ENV=production eslint --print-config . | eslint-config-prettier-check",
"prepare-mobile": "node prepare-mobile.js",
"release-mobile": "node prepare-mobile-release.js",
"postbuild": "yarn prepare-mobile",
"precommit": "pretty-quick --staged"
}


Is there any way to output the SASS source map other than the above approach and without having to eject webpack?










share|improve this question

























  • Read about agairing's temporary fix for Firefox in github.com/facebook/create-react-app/issues/5707. You can also see the code changes here: github.com/facebook/create-react-app/pull/6472/commits/…. I can confirm this worked for me. I hope it helps!

    – trig
    Feb 26 at 17:23














1












1








1


2






SASS source map fails to output on create-react-app 2 (reported bug), been trying to find a workaround to this while an official fix is being considered.



Another user suggested adding the below to scripts:



"scripts": {
"build-css": "node-sass --source-map true --include-path ./src --include-path ./node_modules src/assets/sass -o public/css",
"watch-css": "npm run build-css && node-sass --source-map true --include-path ./src --include-path ./node_modules src/assets/sass -o public/css --watch --recursive"


This does the trick but generating another CSS which would get picked up outside of webpack, also breaking CSS injection (hot loading).



This is how the CSS is being included (via import on the index.js file). Ideally this should remain as is.



import "styles/main.scss";


Below the package.json (react-scripts v2.1.1):



"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"lint": "NODE_ENV=production eslint src --ext '.js,.jsx'",
"lint-fix": "yarn lint --fix",
"lint-check": "NODE_ENV=production eslint --print-config . | eslint-config-prettier-check",
"prepare-mobile": "node prepare-mobile.js",
"release-mobile": "node prepare-mobile-release.js",
"postbuild": "yarn prepare-mobile",
"precommit": "pretty-quick --staged"
}


Is there any way to output the SASS source map other than the above approach and without having to eject webpack?










share|improve this question
















SASS source map fails to output on create-react-app 2 (reported bug), been trying to find a workaround to this while an official fix is being considered.



Another user suggested adding the below to scripts:



"scripts": {
"build-css": "node-sass --source-map true --include-path ./src --include-path ./node_modules src/assets/sass -o public/css",
"watch-css": "npm run build-css && node-sass --source-map true --include-path ./src --include-path ./node_modules src/assets/sass -o public/css --watch --recursive"


This does the trick but generating another CSS which would get picked up outside of webpack, also breaking CSS injection (hot loading).



This is how the CSS is being included (via import on the index.js file). Ideally this should remain as is.



import "styles/main.scss";


Below the package.json (react-scripts v2.1.1):



"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"lint": "NODE_ENV=production eslint src --ext '.js,.jsx'",
"lint-fix": "yarn lint --fix",
"lint-check": "NODE_ENV=production eslint --print-config . | eslint-config-prettier-check",
"prepare-mobile": "node prepare-mobile.js",
"release-mobile": "node prepare-mobile-release.js",
"postbuild": "yarn prepare-mobile",
"precommit": "pretty-quick --staged"
}


Is there any way to output the SASS source map other than the above approach and without having to eject webpack?







reactjs webpack create-react-app package.json






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 7 '18 at 20:08







Syden

















asked Nov 23 '18 at 16:28









SydenSyden

6,71241733




6,71241733













  • Read about agairing's temporary fix for Firefox in github.com/facebook/create-react-app/issues/5707. You can also see the code changes here: github.com/facebook/create-react-app/pull/6472/commits/…. I can confirm this worked for me. I hope it helps!

    – trig
    Feb 26 at 17:23



















  • Read about agairing's temporary fix for Firefox in github.com/facebook/create-react-app/issues/5707. You can also see the code changes here: github.com/facebook/create-react-app/pull/6472/commits/…. I can confirm this worked for me. I hope it helps!

    – trig
    Feb 26 at 17:23

















Read about agairing's temporary fix for Firefox in github.com/facebook/create-react-app/issues/5707. You can also see the code changes here: github.com/facebook/create-react-app/pull/6472/commits/…. I can confirm this worked for me. I hope it helps!

– trig
Feb 26 at 17:23





Read about agairing's temporary fix for Firefox in github.com/facebook/create-react-app/issues/5707. You can also see the code changes here: github.com/facebook/create-react-app/pull/6472/commits/…. I can confirm this worked for me. I hope it helps!

– trig
Feb 26 at 17:23












1 Answer
1






active

oldest

votes


















0














UPDATE 2/20/2019: The 2.1.4 fix mentioned in the original answer below generates a new bug which you might want to check before upgrading.



Due to this, the 2.1.4 fix will most likely be reverted.



If you wish to avoid the new bug please stay on 2.1.3 or lower.





Original Answer:



Good news! This has been fixed on CRA v2.1.4. Works on Chrome only though. Firefox still suffering blob bug since v59 & Safari doesn't work either.



To solve it, update your create react app version on your package.json to either latest 2.1.5 or ^2.1.4 and run npm install



"devDependencies": {
"react-scripts": "2.1.5",
}


Ref #5713:
enter image description here



Chrome (working fine):
enter image description here



Firefox (bugged):
enter image description here






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%2f53450140%2fcreate-react-app-sass-source-maps-not-working%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














    UPDATE 2/20/2019: The 2.1.4 fix mentioned in the original answer below generates a new bug which you might want to check before upgrading.



    Due to this, the 2.1.4 fix will most likely be reverted.



    If you wish to avoid the new bug please stay on 2.1.3 or lower.





    Original Answer:



    Good news! This has been fixed on CRA v2.1.4. Works on Chrome only though. Firefox still suffering blob bug since v59 & Safari doesn't work either.



    To solve it, update your create react app version on your package.json to either latest 2.1.5 or ^2.1.4 and run npm install



    "devDependencies": {
    "react-scripts": "2.1.5",
    }


    Ref #5713:
    enter image description here



    Chrome (working fine):
    enter image description here



    Firefox (bugged):
    enter image description here






    share|improve this answer






























      0














      UPDATE 2/20/2019: The 2.1.4 fix mentioned in the original answer below generates a new bug which you might want to check before upgrading.



      Due to this, the 2.1.4 fix will most likely be reverted.



      If you wish to avoid the new bug please stay on 2.1.3 or lower.





      Original Answer:



      Good news! This has been fixed on CRA v2.1.4. Works on Chrome only though. Firefox still suffering blob bug since v59 & Safari doesn't work either.



      To solve it, update your create react app version on your package.json to either latest 2.1.5 or ^2.1.4 and run npm install



      "devDependencies": {
      "react-scripts": "2.1.5",
      }


      Ref #5713:
      enter image description here



      Chrome (working fine):
      enter image description here



      Firefox (bugged):
      enter image description here






      share|improve this answer




























        0












        0








        0







        UPDATE 2/20/2019: The 2.1.4 fix mentioned in the original answer below generates a new bug which you might want to check before upgrading.



        Due to this, the 2.1.4 fix will most likely be reverted.



        If you wish to avoid the new bug please stay on 2.1.3 or lower.





        Original Answer:



        Good news! This has been fixed on CRA v2.1.4. Works on Chrome only though. Firefox still suffering blob bug since v59 & Safari doesn't work either.



        To solve it, update your create react app version on your package.json to either latest 2.1.5 or ^2.1.4 and run npm install



        "devDependencies": {
        "react-scripts": "2.1.5",
        }


        Ref #5713:
        enter image description here



        Chrome (working fine):
        enter image description here



        Firefox (bugged):
        enter image description here






        share|improve this answer















        UPDATE 2/20/2019: The 2.1.4 fix mentioned in the original answer below generates a new bug which you might want to check before upgrading.



        Due to this, the 2.1.4 fix will most likely be reverted.



        If you wish to avoid the new bug please stay on 2.1.3 or lower.





        Original Answer:



        Good news! This has been fixed on CRA v2.1.4. Works on Chrome only though. Firefox still suffering blob bug since v59 & Safari doesn't work either.



        To solve it, update your create react app version on your package.json to either latest 2.1.5 or ^2.1.4 and run npm install



        "devDependencies": {
        "react-scripts": "2.1.5",
        }


        Ref #5713:
        enter image description here



        Chrome (working fine):
        enter image description here



        Firefox (bugged):
        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 20 at 20:07

























        answered Feb 18 at 20:08









        SydenSyden

        6,71241733




        6,71241733
































            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%2f53450140%2fcreate-react-app-sass-source-maps-not-working%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

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            RAC Tourist Trophy