electron-vue & puppeteer how to config babel keep async await to work well for await page.evaluate(async () => {})

Viewed 91

electron-vue template

electron-vue

puppeteer-core

await page.evaluate(async (url) => {

})
// pass babel and run error

.babelrc

{
  "comments": false,
  "env": {
    "main": {
      "presets": [
        ["env", {
          "targets": { "node": 7 }
        }],
        "stage-0"
      ]
    },
    "renderer": {
      "presets": [
        ["env", {
          "modules": false
        }],
        "stage-0"
      ]
    },
    "web": {
      "presets": [
        ["env", {
          "modules": false
        }],
        "stage-0"
      ]
    }
  },
  "plugins": ["transform-runtime"]
}

dependences

"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.26.0",
"babili-webpack-plugin": "^0.1.2"

page.evaluate(async ()=> {})

async method in page.evaluate will be transformed by Babel, causing the execution of the puppeter to fail. What should I do, Thank you very much for any help

0 Answers
Related