René's URL Explorer Experiment


Title: buildStart hook is not async in webpack · Issue #293 · unjs/unplugin · GitHub

Open Graph Title: buildStart hook is not async in webpack · Issue #293 · unjs/unplugin

X Title: buildStart hook is not async in webpack · Issue #293 · unjs/unplugin

Description: Environment unplugin 1.3.1 webpack 5.76.2 Node.js v16.14.2 Reproduction Have buildStart perform async operation. Have transform hook rely on ordered completion buildStart and its result. StackBlitz: https://stackblitz.com/edit/webpack-we...

Open Graph Description: Environment unplugin 1.3.1 webpack 5.76.2 Node.js v16.14.2 Reproduction Have buildStart perform async operation. Have transform hook rely on ordered completion buildStart and its result. StackBlitz...

X Description: Environment unplugin 1.3.1 webpack 5.76.2 Node.js v16.14.2 Reproduction Have buildStart perform async operation. Have transform hook rely on ordered completion buildStart and its result. StackBlitz...

Opengraph URL: https://github.com/unjs/unplugin/issues/293

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"buildStart hook is not async in webpack","articleBody":"### Environment\n\nunplugin 1.3.1\r\nwebpack 5.76.2\r\nNode.js v16.14.2\n\n### Reproduction\n\n1. Have `buildStart` perform async operation.\r\n2. Have `transform` hook rely on ordered completion `buildStart` and its result.\r\n\r\nStackBlitz: \u003chttps://stackblitz.com/edit/webpack-webpack-js-org-1qvdhq?file=package.json&view=editor> (`pnpm start` to run webpack programmatically, `pnpm test` to run tests which will also do the build programatically).\n\n### Describe the bug\n\n`buildStart` is not an async hook, and invoking `await` will immediately continue the build pipeline, which will have unexpected consequences.\r\n\r\nVitest:\r\n```\r\n-- webpack call\r\n-- webpack end\r\n\r\n-- buildStart call         ← buildStart waits 1 second to resolve a promise\r\n\r\n-- transform call          ← transform called before buildStart is fulfilled\r\n× transform thrown Error: transform method was called either before buildStart call was completed or after it has thrown an error\r\n-- transform end\r\n\r\n√ buildStart return        ← timer fires, buildStart fulfills\r\n-- buildStart end\r\n\r\n(Test timeout)\r\n```\r\n\r\nNode.js:\r\n```\r\n-- webpack call\r\n-- webpack end\r\n\r\n-- buildStart call\r\n\r\n-- transform call\r\ntransform call without without buildStart completion, throwing!\r\n× transform thrown Error: transform method was called either before buildStart call was completed or after it has thrown an error\r\n-- transform end\r\n\r\n UNHANDLED EXPECTION \r\n Error: transform method was called either before buildStart call was completed or after it has thrown an error\r\n\r\n (Process halted with error code)\r\n```\n\n### Additional context\n\n- In Rollup/Vite realm `buildStart` is async and can be used to perform initial initialisation for `transform` hook invocations.\r\n- `transform` hook seems to be correctly async, which means you can await for `buildStart` fulfillment in it, which involves moving async logic of `buildStart` to a separate function and then also creating another plugin variable in which you will store promise returned by that separate async function call. But it's not obvious and still feels like a mistake/oversight.\n\n### Logs\n\n```sh\nN/A.\n```\n","author":{"url":"https://github.com/brawaru","@type":"Person","name":"brawaru"},"datePublished":"2023-03-20T16:34:43Z","url":"https://github.com/unjs/unplugin/issues/293"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:99989ff8-b7e2-1f26-2b18-57acad40d640
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8E9C:29A20E:2AE97BB:3A8C1C6:6B005291
html-safe-nonceacc034ccbc717cc752afeb29dcfcf83e9240a1072b2fb188d0a730923bc7529d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTlDOjI5QTIwRToyQUU5N0JCOjNBOEMxQzY6NkIwMDUyOTEiLCJ2aXNpdG9yX2lkIjoiNTI4OTYzOTYxNTY4OTQxMzI2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace6f6c70121b84fe198df82c548234c2d3ead5f399609ebfec0e9ba232baa1bd6
hovercard-subject-tagissue:1632478957
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/unjs/unplugin/293/issue_layout
twitter:imagehttps://opengraph.githubassets.com/7addbb84620a1cc93d3da2f2ee79bf8ee1337da52807c3d6b14af577780016aa/unjs/unplugin/issues/293
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/7addbb84620a1cc93d3da2f2ee79bf8ee1337da52807c3d6b14af577780016aa/unjs/unplugin/issues/293
og:image:altEnvironment unplugin 1.3.1 webpack 5.76.2 Node.js v16.14.2 Reproduction Have buildStart perform async operation. Have transform hook rely on ordered completion buildStart and its result. StackBlitz...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebrawaru
hostnamegithub.com
expected-hostnamegithub.com
Nonef420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb
turbo-cache-controlno-preview
go-importgithub.com/unjs/unplugin git https://github.com/unjs/unplugin.git
octolytics-dimension-user_id80154025
octolytics-dimension-user_loginunjs
octolytics-dimension-repository_id385261169
octolytics-dimension-repository_nwounjs/unplugin
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id385261169
octolytics-dimension-repository_network_root_nwounjs/unplugin
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release26e00df917aba0f128135dc073ea0c5e33a70d40
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/unjs/unplugin/issues/293#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Funjs%2Funplugin%2Fissues%2F293
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Funjs%2Funplugin%2Fissues%2F293
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=unjs%2Funplugin
Reloadhttps://github.com/unjs/unplugin/issues/293
Reloadhttps://github.com/unjs/unplugin/issues/293
Reloadhttps://github.com/unjs/unplugin/issues/293
unjshttps://github.com/unjs
unpluginhttps://github.com/unjs/unplugin
Codehttps://github.com/unjs/unplugin
Issues33 (33)https://github.com/unjs/unplugin/issues
Pull requests8 (8)https://github.com/unjs/unplugin/pulls
Actionshttps://github.com/unjs/unplugin/actions
Security and qualityhttps://github.com/unjs/unplugin/security
Insightshttps://github.com/unjs/unplugin/insights
https://github.com/unjs/unplugin
New issuehttps://github.com/login?return_to=https://github.com/unjs/unplugin/issues/293
New issuehttps://github.com/login?return_to=https://github.com/unjs/unplugin/issues/293
buildStart hook is not async in webpackhttps://github.com/unjs/unplugin/issues/293#top
webpackhttps://github.com/unjs/unplugin/issues?q=state%3Aopen%20label%3A%22webpack%22
https://github.com/brawaru
brawaruhttps://github.com/brawaru
on Mar 20, 2023https://github.com/unjs/unplugin/issues/293#issue-1632478957
https://stackblitz.com/edit/webpack-webpack-js-org-1qvdhq?file=package.json&view=editorhttps://stackblitz.com/edit/webpack-webpack-js-org-1qvdhq?file=package.json&view=editor
https://github.com/wChenonly
wChenonlyhttps://github.com/wChenonly
on Jun 12, 2023https://github.com/unjs/unplugin/issues/293#issuecomment-1586748350
https://github.com/LorisSigrist
LorisSigristhttps://github.com/LorisSigrist
on Nov 27, 2023https://github.com/unjs/unplugin/issues/293#issuecomment-1827952501
https://github.com/wChenonly
wChenonlyhttps://github.com/wChenonly
on Dec 1, 2023https://github.com/unjs/unplugin/issues/293#issuecomment-1835399686
northernColdhttps://github.com/northernCold
on May 2, 2024https://github.com/unjs/unplugin/issues/293#event-12677344645
fix: buildStart hook is not async in webpackhttps://github.com/northernCold/unplugin-tailwindcss-shortener/commit/98fcb17dd33c3850f3d3445297de554bd413e822
98fcb17https://github.com/northernCold/unplugin-tailwindcss-shortener/commit/98fcb17dd33c3850f3d3445297de554bd413e822
sxzzhttps://github.com/sxzz
webpackhttps://github.com/unjs/unplugin/issues?q=state%3Aopen%20label%3A%22webpack%22
on Jul 1, 2024https://github.com/unjs/unplugin/issues/293#event-13348716889
https://github.com/SoonIter
SoonIterhttps://github.com/SoonIter
on Dec 4, 2024https://github.com/unjs/unplugin/issues/293#issuecomment-2516705421
unplugin/src/webpack/index.tshttps://github.com/unjs/unplugin/blob/1b697de135c32d0fc60a2612c728d60a15dc1433/src/webpack/index.ts#L183-L203
1b697dehttps://github.com/unjs/unplugin/commit/1b697de135c32d0fc60a2612c728d60a15dc1433
https://github.com/web-infra-dev/rspack/blob/4bc1d680fa37c5dd7a40c7a60febd832ea3a03f9/crates/rspack_core/src/compiler/mod.rs#L33https://github.com/web-infra-dev/rspack/blob/4bc1d680fa37c5dd7a40c7a60febd832ea3a03f9/crates/rspack_core/src/compiler/mod.rs#L33
https://private-user-images.githubusercontent.com/79413249/392299769-3f1d9ac9-9a4d-4e34-9437-84cab812cc0f.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTUxODM1NTAsIm5iZiI6MTc5NTE4MzI1MCwicGF0aCI6Ii83OTQxMzI0OS8zOTIyO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ViZTE2YjJmOGRiODUwMzI0ZmFlNTYyNGM3MTZjNjVmOWEyMzU2NzhlNDZiNDYxZTQ0MzBmYjEwMDE1NDY3NGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.2ZUh67AyviMV8bNn-eFHMhI4-K4C4peTimSJjwFd_Zw
#293 (comment)https://github.com/unjs/unplugin/issues/293#issuecomment-1827952501
Sign up for freehttps://github.com/signup?return_to=https://github.com/unjs/unplugin/issues/293
Sign in to commenthttps://github.com/login?return_to=https://github.com/unjs/unplugin/issues/293
webpackhttps://github.com/unjs/unplugin/issues?q=state%3Aopen%20label%3A%22webpack%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.