diff --git a/src/commands/build.ts b/src/commands/build.ts index 1905b6c..05fb2f6 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -142,8 +142,9 @@ export async function build(options: Record) { dropLabels: [buildConfig.mode === 'production' ? '__DEV__' : '__PROD__', ...buildConfig.dropLabels!], }); if(options.watch) { + await ctx.watch() } else { - ctx.rebuild() - ctx.dispose() + await ctx.rebuild() + await ctx.dispose() } } diff --git a/src/index.ts b/src/index.ts index 9bfcc7c..e60e155 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,6 +66,7 @@ program .description('Build your bot') .option('-f --format [fmt]', 'The module system of your application. `cjs` or `esm`', 'esm') .option('-m --mode [mode]', 'the mode for sern to build in. `production` or `development`', 'development') + .option('-w --watch') .option('-W --suppress-warnings', 'suppress experimental warning') .option('-p --project [filePath]', 'build with the provided sern.build file') .option('-e --env', 'path to .env file')