lisonge / vite-plugin-monkey

A vite plugin server and build your.user.js for userscript engine like Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat
MIT License
1.31k stars 70 forks source link

[bugs] top level await + optional chaining (?.) will build product syntax error #101

Closed lisonge closed 1 year ago

lisonge commented 1 year ago
// main.ts
// bugs reproduction
// top level await
console.log(await window?.fetch(`/`));
export {};
// test-top-level-await.user.js
// ==UserScript==
// @name       test-top-level-await
// @namespace  vite-plugin-monkey
// @version    0.0.0
// @author     monkey
// @match      https://songe.li
// ==/UserScript==

(async function () {
    'use strict';

    console.log((await fetch == null ? void 0 : fetch(`/`))));
        // An extra parenthesis
})();
lisonge commented 1 year ago

fixed by v3.4.1