Parcel + Babel not transpiling ES6 from node_modules?











up vote
0
down vote

favorite












I can't seem to get Babel to work with Parcel, although the presets are being installed automatically. It works locally and in Chrome, but it's not transpiling node_modules es6 files, so the output still has const/let/... and it cannot run in Safari.



.babelrc



{
"presets": ["@babel/preset-env","@babel/preset-react"]
}


(I've also tried the env and react ones).



package.json scripts



"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html",


Why would this be?



Full package.json (note this is after messing around in order to try to get it working)



{
"name": "my-react-app",
"version": "1.0.0",
"description": "",
"main": "src/index.js",
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html"
},
"author": "",
"license": "ISC",
"dependencies": {
"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"@babel/preset-react": "^7.0.0",
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"browserslist": "^4.3.4",
"lodash": "^4.17.11",
"node-sass": "^4.10.0",
"pinyin": "^2.8.3",
"prop-types": "^15.6.2",
"react": "^16.6.1",
"react-dom": "^16.6.1",
"react-notifications": "^1.4.3",
"react-router-dom": "^4.3.1"
},
"devDependencies": {
"cssnano": "^4.1.7",
"sass": "^1.14.3"
}
}


Still getting .js files with const, let. Any ideas what I am missing?










share|improve this question


























    up vote
    0
    down vote

    favorite












    I can't seem to get Babel to work with Parcel, although the presets are being installed automatically. It works locally and in Chrome, but it's not transpiling node_modules es6 files, so the output still has const/let/... and it cannot run in Safari.



    .babelrc



    {
    "presets": ["@babel/preset-env","@babel/preset-react"]
    }


    (I've also tried the env and react ones).



    package.json scripts



    "scripts": {
    "start": "parcel index.html",
    "build": "parcel build index.html",


    Why would this be?



    Full package.json (note this is after messing around in order to try to get it working)



    {
    "name": "my-react-app",
    "version": "1.0.0",
    "description": "",
    "main": "src/index.js",
    "scripts": {
    "start": "parcel index.html",
    "build": "parcel build index.html"
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
    "@babel/core": "^7.1.5",
    "@babel/preset-env": "^7.1.5",
    "@babel/preset-react": "^7.0.0",
    "axios": "^0.18.0",
    "babel-polyfill": "^6.26.0",
    "browserslist": "^4.3.4",
    "lodash": "^4.17.11",
    "node-sass": "^4.10.0",
    "pinyin": "^2.8.3",
    "prop-types": "^15.6.2",
    "react": "^16.6.1",
    "react-dom": "^16.6.1",
    "react-notifications": "^1.4.3",
    "react-router-dom": "^4.3.1"
    },
    "devDependencies": {
    "cssnano": "^4.1.7",
    "sass": "^1.14.3"
    }
    }


    Still getting .js files with const, let. Any ideas what I am missing?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I can't seem to get Babel to work with Parcel, although the presets are being installed automatically. It works locally and in Chrome, but it's not transpiling node_modules es6 files, so the output still has const/let/... and it cannot run in Safari.



      .babelrc



      {
      "presets": ["@babel/preset-env","@babel/preset-react"]
      }


      (I've also tried the env and react ones).



      package.json scripts



      "scripts": {
      "start": "parcel index.html",
      "build": "parcel build index.html",


      Why would this be?



      Full package.json (note this is after messing around in order to try to get it working)



      {
      "name": "my-react-app",
      "version": "1.0.0",
      "description": "",
      "main": "src/index.js",
      "scripts": {
      "start": "parcel index.html",
      "build": "parcel build index.html"
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
      "@babel/core": "^7.1.5",
      "@babel/preset-env": "^7.1.5",
      "@babel/preset-react": "^7.0.0",
      "axios": "^0.18.0",
      "babel-polyfill": "^6.26.0",
      "browserslist": "^4.3.4",
      "lodash": "^4.17.11",
      "node-sass": "^4.10.0",
      "pinyin": "^2.8.3",
      "prop-types": "^15.6.2",
      "react": "^16.6.1",
      "react-dom": "^16.6.1",
      "react-notifications": "^1.4.3",
      "react-router-dom": "^4.3.1"
      },
      "devDependencies": {
      "cssnano": "^4.1.7",
      "sass": "^1.14.3"
      }
      }


      Still getting .js files with const, let. Any ideas what I am missing?










      share|improve this question













      I can't seem to get Babel to work with Parcel, although the presets are being installed automatically. It works locally and in Chrome, but it's not transpiling node_modules es6 files, so the output still has const/let/... and it cannot run in Safari.



      .babelrc



      {
      "presets": ["@babel/preset-env","@babel/preset-react"]
      }


      (I've also tried the env and react ones).



      package.json scripts



      "scripts": {
      "start": "parcel index.html",
      "build": "parcel build index.html",


      Why would this be?



      Full package.json (note this is after messing around in order to try to get it working)



      {
      "name": "my-react-app",
      "version": "1.0.0",
      "description": "",
      "main": "src/index.js",
      "scripts": {
      "start": "parcel index.html",
      "build": "parcel build index.html"
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
      "@babel/core": "^7.1.5",
      "@babel/preset-env": "^7.1.5",
      "@babel/preset-react": "^7.0.0",
      "axios": "^0.18.0",
      "babel-polyfill": "^6.26.0",
      "browserslist": "^4.3.4",
      "lodash": "^4.17.11",
      "node-sass": "^4.10.0",
      "pinyin": "^2.8.3",
      "prop-types": "^15.6.2",
      "react": "^16.6.1",
      "react-dom": "^16.6.1",
      "react-notifications": "^1.4.3",
      "react-router-dom": "^4.3.1"
      },
      "devDependencies": {
      "cssnano": "^4.1.7",
      "sass": "^1.14.3"
      }
      }


      Still getting .js files with const, let. Any ideas what I am missing?







      reactjs babeljs transpiler parceljs






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 11 at 15:23









      Kevin Van Ryckegem

      96421237




      96421237
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          I've found a solution to it from https://github.com/parcel-bundler/parcel/issues/1655#issuecomment-425593377



          // .browserslistrc.packages
          node 10.11

          // package.json
          {
          "scripts": {
          "postinstall": "npm-run-all -p "postinstall:*"",
          "postinstall:p-retry": "cpy --rename=.browserslistrc .browserslistrc.packages node_modules/p-retry",
          "postinstall:query-string": "cpy --rename=.browserslistrc .browserslistrc.packages node_modules/query-string"
          }
          }


          Add a postinstall:package-name for every npm package that you need to add transpilation (in my case, pinyin) and run npm run postinstall after every npm install. Babel should now also transpile that npm package!






          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',
            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%2f53250175%2fparcel-babel-not-transpiling-es6-from-node-modules%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








            up vote
            0
            down vote













            I've found a solution to it from https://github.com/parcel-bundler/parcel/issues/1655#issuecomment-425593377



            // .browserslistrc.packages
            node 10.11

            // package.json
            {
            "scripts": {
            "postinstall": "npm-run-all -p "postinstall:*"",
            "postinstall:p-retry": "cpy --rename=.browserslistrc .browserslistrc.packages node_modules/p-retry",
            "postinstall:query-string": "cpy --rename=.browserslistrc .browserslistrc.packages node_modules/query-string"
            }
            }


            Add a postinstall:package-name for every npm package that you need to add transpilation (in my case, pinyin) and run npm run postinstall after every npm install. Babel should now also transpile that npm package!






            share|improve this answer

























              up vote
              0
              down vote













              I've found a solution to it from https://github.com/parcel-bundler/parcel/issues/1655#issuecomment-425593377



              // .browserslistrc.packages
              node 10.11

              // package.json
              {
              "scripts": {
              "postinstall": "npm-run-all -p "postinstall:*"",
              "postinstall:p-retry": "cpy --rename=.browserslistrc .browserslistrc.packages node_modules/p-retry",
              "postinstall:query-string": "cpy --rename=.browserslistrc .browserslistrc.packages node_modules/query-string"
              }
              }


              Add a postinstall:package-name for every npm package that you need to add transpilation (in my case, pinyin) and run npm run postinstall after every npm install. Babel should now also transpile that npm package!






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                I've found a solution to it from https://github.com/parcel-bundler/parcel/issues/1655#issuecomment-425593377



                // .browserslistrc.packages
                node 10.11

                // package.json
                {
                "scripts": {
                "postinstall": "npm-run-all -p "postinstall:*"",
                "postinstall:p-retry": "cpy --rename=.browserslistrc .browserslistrc.packages node_modules/p-retry",
                "postinstall:query-string": "cpy --rename=.browserslistrc .browserslistrc.packages node_modules/query-string"
                }
                }


                Add a postinstall:package-name for every npm package that you need to add transpilation (in my case, pinyin) and run npm run postinstall after every npm install. Babel should now also transpile that npm package!






                share|improve this answer












                I've found a solution to it from https://github.com/parcel-bundler/parcel/issues/1655#issuecomment-425593377



                // .browserslistrc.packages
                node 10.11

                // package.json
                {
                "scripts": {
                "postinstall": "npm-run-all -p "postinstall:*"",
                "postinstall:p-retry": "cpy --rename=.browserslistrc .browserslistrc.packages node_modules/p-retry",
                "postinstall:query-string": "cpy --rename=.browserslistrc .browserslistrc.packages node_modules/query-string"
                }
                }


                Add a postinstall:package-name for every npm package that you need to add transpilation (in my case, pinyin) and run npm run postinstall after every npm install. Babel should now also transpile that npm package!







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 11 at 15:40









                Kevin Van Ryckegem

                96421237




                96421237






























                    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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2f53250175%2fparcel-babel-not-transpiling-es6-from-node-modules%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

                    Xamarin.iOS Cant Deploy on Iphone

                    Glorious Revolution

                    Dulmage-Mendelsohn matrix decomposition in Python