Skip to content

Commit

Permalink
feat(wrangler): Add (temp) no-op entry-point Worker for Workers + Assets
Browse files Browse the repository at this point in the history
  • Loading branch information
CarmenPopoviciu committed Jul 30, 2024
1 parent 246efc8 commit 9e63082
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions packages/wrangler/src/deployment-bundle/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function getEntry(
format?: CfScriptFormat | undefined;
legacyAssets?: string | undefined | boolean;
moduleRoot?: string;
experimentalAssets?: string;
experimentalAssets?: string | undefined;
},
config: Config,
command: "dev" | "deploy" | "types"
Expand All @@ -55,13 +55,10 @@ export async function getEntry(
? path.resolve(config.site?.["entry-point"])
: // site.entry-point could be a directory
path.resolve(config.site?.["entry-point"], "index.js");
} else if (
args.legacyAssets ||
config.legacy_assets ||
args.experimentalAssets ||
config.experimental_assets
) {
} else if (args.legacyAssets || config.legacy_assets) {
file = path.resolve(getBasePath(), "templates/no-op-worker.js");
} else if (args.experimentalAssets || config.experimental_assets) {
file = path.resolve(getBasePath(), "templates/no-op-assets-worker.ts");
} else {
throw new UserError(
`Missing entry-point: The entry-point should be specified via the command line (e.g. \`wrangler ${command} path/to/script\`) or the \`main\` config field.`
Expand Down
4 changes: 2 additions & 2 deletions packages/wrangler/templates/no-op-assets-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
* this Worker is.
*/
type Env = {
ASSET_SERVER: Fetcher
}
ASSET_SERVER: Fetcher;
};

export default {
async fetch(request: Request, env: Env) {
Expand Down

0 comments on commit 9e63082

Please sign in to comment.