Skip to content

Breaking change since ESBuild >0.16 chore commit #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions build/build-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,13 @@ const buildBundle = async () => {
for (const targetOpts of TARGET_ENTRIES) {
const mergedOpts = { ...baseOptions, ...targetOpts };

if (IS_WATCH_MODE) {
mergedOpts.watch = {
onRebuild(error) {
if (error)
console.error(
`[ESBuild Watch] (${targetOpts.entryPoints[0]}) Failed to rebuild bundle`
);
else
console.log(
`[ESBuild Watch] (${targetOpts.entryPoints[0]}) Sucessfully rebuilt bundle`
);
},
};
}
const context = await esbuild.context(mergedOpts);

const { errors } = await esbuild.build(mergedOpts);

if (errors.length) {
console.error(`[ESBuild] Bundle failed with ${errors.length} errors`);
process.exit(1);
if (IS_WATCH_MODE) {
await context.watch();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant await

Suggested change
await context.watch();
context.watch();

} else {
await context.rebuild();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure if esbuild logs errors internally, even though this does happen when using watch mode. Maybe it would be safe to still add a check like we had before.

context.dispose();
}
}
} catch (e) {
Expand Down
Loading