only js/vendor.a6f65168.js not transpile to ES5, babel



  • Hi,

    After running “quasar build”, only js/vendor.a6f65168.js not transpile to ES5.
    Here is my “.babelrc”:

    {
      "presets": [
        [
          "@babel/preset-env"
        ],
        [
          "@babel/preset-stage-2"
        ]
      ],
      "plugins": [
        [
          "@babel/transform-runtime", {
            "helpers": false,
            "polyfill": false,
            "regenerator": true
          }
        ]
      ],
      "comments": false
    }
    

    Other js files which are already transpiled to ES5.

    0047f503.d5bf05a4.js  1f31fd06.64fe1cd4.js  356b2fa4.ad5b4e97.js  4eda64bc.72c43d3f.js  63621713.90297aad.js  a72382ca.f3a1d888.js  e8e21c70.dc0ee236.js
    01ec88ef.661605ff.js  30707848.8f2b92a4.js  46471b12.2124773a.js  50209ee6.92948ed2.js  a06b116c.1c4a9c4c.js  ade2b0ac.716ac4f3.js  runtime.3179d1de.js
    08282c5b.7654f67d.js  35201f27.1af69858.js  4a3a12e7.7f8c4c2b.js  5a72a35a.4c2d7e49.js  a611788e.74ac81be.js  app.602888a3.js 
    

    How to transpile the vendor file to ES5 as well?

    Thank you


  • Admin

    quasar.conf.js > build > transpileDependencies —> More here: https://quasar-framework.org/guide/app-quasar.conf.js.html#build-Property



  • Thank you for your reply.
    Need your help further.

    My understanding is:
    some dependencies are transpiled to the vendor js file, set those dependency names under the
    quasar.conf.js > build > transpileDependencies will solve the problem.

    If it’s correct, how to find those dependencies?



  • I’ve been thru this - you’ll have to combine a strategy of decoding error messages and walking thru your dependencies and seeing if adding them to the transpileDependencies array fixes it. I use a vuex-persist module that needs to be transpiled:

      transpileDependencies: [/vuex-persist/]


  • Thank you, jeffatpf
    After some struggles, it comes to a temporary workaround:

    • quasar.conf.js
          transpileDependencies: [
            'vuex-persist',
            'webpack-dev-server',
            'ansi-strip'
          ],
    
    • manually transpile the vendor file by another node - babel project with the 2 config
      package.json
    {
      "name": "es6-es5",
      "version": "1.0.0",
      "description": "",
      "main": "vendor.37b91565.js",
      "scripts": {
        "build": "npx babel vendor.dee81ebe.js --out-file out/vendor.dee81ebe.js",
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "",
      "license": "ISC",
      "devDependencies": {
        "@babel/cli": "^7.2.3",
        "@babel/core": "^7.3.3",
        "@babel/plugin-proposal-object-rest-spread": "^7.3.2",
        "@babel/preset-env": "^7.3.1"
      }
    }
    

    .babelrc

    {
      "presets": [
        [
          "@babel/preset-env",
          {
            "targets": {
              "ie": "9"
            }
          }
        ]
      ],
      "plugins": [
        "@babel/plugin-proposal-object-rest-spread"
      ]
    }
    

    runnpm run build to transpile the vendor file



  • @jeffatpf Actually I still don’t know the right way to debug and find the corresponding dependencies.



  • Is it appropriate the transpile all dependencies under node_modules? If it’s, how to do it?


Log in to reply