You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Output code: !async function(){let o;const s=await (o||(o=Promise.resolve("this is a string")));console.log(s.toString())}();
Eval result: this is a string
😯 Current Behavior
Output code: !async function(){let o;const s=await o||(o=Promise.resolve("this is a string"));console.log(s.toString())}();
Eval result: [object Promise]
💁 Possible Solution
Don't remove parentheses where that changes the code
🔦 Context
I happily deployed my code to production and it broke. After an hour of debugging and hating yarn berry or whatever gave me this issue when I tried to upgrade parcel:
🚨 Build failed.
@parcel/core: Failed to resolve 'src/test/temp-12545.tsx'
@parcel/resolver-default: The "path" argument must be of type string. Received undefined
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:371:5)
at validateString (node:internal/validators:119:11)
at Object.isAbsolute (node:path:1157:5)
at NodeResolver.resolveModule
([project_dir]/.yarn/cache/@parcel-node-resolver-core-npm-2.0.0-nightly.2418-a46b40c4e1-9a61779ada.zip/node_modules/@parcel/node-resolver-core/lib/NodeResolver.js:224:25)
at async NodeResolver.resolve
([project_dir]/.yarn/cache/@parcel-node-resolver-core-npm-2.0.0-nightly.2418-a46b40c4e1-9a61779ada.zip/node_modules/@parcel/node-resolver-core/lib/NodeResolver.js:137:20)
at async ResolverRunner.resolve
([project_dir]/.yarn/cache/@parcel-core-npm-2.0.0-nightly.809-cffd5f51ab-eda7e37cd3.zip/node_modules/@parcel/core/lib/requests/PathRequest.js:207:22)
at async Object.run ([project_dir]/.yarn/cache/@parcel-core-npm-2.0.0-nightly.809-cffd5f51ab-eda7e37cd3.zip/node_modules/@parcel/core/lib/requests/PathRequest.js:104:16)
at async RequestTracker.runRequest ([project_dir]/.yarn/cache/@parcel-core-npm-2.0.0-nightly.809-cffd5f51ab-eda7e37cd3.zip/node_modules/@parcel/core/lib/RequestTracker.js:711:20)
at async AssetGraphBuilder.runPathRequest
([project_dir]/.yarn/cache/@parcel-core-npm-2.0.0-nightly.809-cffd5f51ab-eda7e37cd3.zip/node_modules/@parcel/core/lib/requests/AssetGraphRequest.js:722:18)
at async PromiseQueue._runFn ([project_dir]/.yarn/cache/@parcel-utils-npm-2.0.0-nightly.811-05dc7f2595-6b3d9e3e8a.zip/node_modules/@parcel/utils/lib/PromiseQueue.js:88:7)
I have finally produced this issue report.
Similar issue: #5759
💻 Code Sample
main();
async function main() {
let promise: Promise<string>;
const awaited_promise = await (promise ||= Promise.resolve("this is a string"));
console.log(awaited_promise.toString());
}
🌍 Your Environment
Software
Version(s)
Parcel
2.0.0-nightly.809+95f5648d
Node
v16.7.0
npm/Yarn
yarn 3.0.1
Operating System
macOS 10.15.7 (19H1323)
The text was updated successfully, but these errors were encountered:
🐛 bug report
Parcel (I think it's SWC because babel seems to do it correctly) doesn't do precedence correctly when using await and logical OR assignment.
🎛 Configuration (.babelrc, package.json, cli command)
🤔 Expected Behavior
Output code:
!async function(){let o;const s=await (o||(o=Promise.resolve("this is a string")));console.log(s.toString())}();
Eval result:
this is a string
😯 Current Behavior
Output code:
!async function(){let o;const s=await o||(o=Promise.resolve("this is a string"));console.log(s.toString())}();
Eval result:
[object Promise]
💁 Possible Solution
Don't remove parentheses where that changes the code
🔦 Context
I happily deployed my code to production and it broke. After an hour of debugging and hating yarn berry or whatever gave me this issue when I tried to upgrade parcel:
I have finally produced this issue report.
Similar issue: #5759
💻 Code Sample
🌍 Your Environment
The text was updated successfully, but these errors were encountered: