Skip to content

Commit

Permalink
more validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Apr 13, 2022
1 parent b1ff9fe commit bf9e478
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/adapter-cloudflare-workers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ function validate_config(builder) {
);
}

// @ts-ignore
if (!wrangler_config.build || !wrangler_config.build.upload) {
throw new Error(
'You must specify build.upload options in wrangler.toml. Consult https://github.com/sveltejs/kit/tree/master/packages/adapter-cloudflare-workers'
);
}

// @ts-ignore
if (wrangler_config.build.upload.format !== 'modules') {
throw new Error('build.upload.format in wrangler.toml must be "modules"');
}

// @ts-ignore
const main_file = wrangler_config.build?.upload?.main;
const main_file_ext = main_file?.split('.').slice(-1)[0];
Expand Down

0 comments on commit bf9e478

Please sign in to comment.