-
Notifications
You must be signed in to change notification settings - Fork 505
Closed
Labels
kind: bugSomething isn't workingSomething isn't workingscope: upstreamIssue in upstream dependencyIssue in upstream dependencysolution: workaround availableThere is a workaround available for this issueThere is a workaround available for this issuetopic: async-to-promisesRelated to bugs with babel-plugin-async-to-promisesRelated to bugs with babel-plugin-async-to-promises
Description
Current Behavior
Hello! Thank you for making this awesome tool.
By the way, an error occurred while testing to set up the project using this tool.
const puppeteer = require('puppeteer')
;(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('https://example.com')
await page.screenshot({ path: 'example.png' })
await browser.close()
})()
Error: 'return' outside of function (Note that you need plugins to import files that are not JavaScript)
at /Users/seungdols/dev/getGold/src/index.ts:3:24
1: const puppeteer = require('puppeteer')
2: ;(async () => {
3: const browser = await puppeteer.launch()
^
4: const page = await browser.newPage()
5: await page.goto('https://example.com')
Expected behavior
If you build using tsc, it is a code that builds normally.
Why this error message?
I can’t build a module of puppeteer example code.
I would like to know why the error occurs in a simple async/await code.
And I couldn't understand exactly what the error message was saying, so I had to ask a question.
What exactly did I do wrong with this error message? I don't know, can you change the message a little more kindly?
And can you guide me on how to solve this problem?
Your environment
OSX 10.15.6
Node 12.16.3
Metadata
Metadata
Assignees
Labels
kind: bugSomething isn't workingSomething isn't workingscope: upstreamIssue in upstream dependencyIssue in upstream dependencysolution: workaround availableThere is a workaround available for this issueThere is a workaround available for this issuetopic: async-to-promisesRelated to bugs with babel-plugin-async-to-promisesRelated to bugs with babel-plugin-async-to-promises