Skip to content

Commit

Permalink
additionalModules
Browse files Browse the repository at this point in the history
  • Loading branch information
penalosa committed Jun 10, 2024
1 parent 6dd781b commit 25e59ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
6 changes: 2 additions & 4 deletions packages/wrangler/src/api/startDevWorker/BundlerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export class BundlerController extends Controller<BundlerControllerEventMap> {
return;
}
assert(this.#tmpDir);
assert(config._additionalModules, "config._additionalModules");
assert(config.build?.moduleRules, "config.build?.moduleRules");
assert(config.build?.define, "config.build?.define");
if (!config.build?.bundle) {
Expand Down Expand Up @@ -193,7 +192,6 @@ export class BundlerController extends Controller<BundlerControllerEventMap> {
return;
}
assert(this.#tmpDir);
assert(config._additionalModules, "config._additionalModules");
assert(config.build?.moduleRules, "config.build?.moduleRules");
assert(config.build?.define, "config.build?.define");
const entry: Entry = {
Expand All @@ -208,8 +206,8 @@ export class BundlerController extends Controller<BundlerControllerEventMap> {
destination: this.#tmpDir.path,
jsxFactory: config.build?.jsxFactory,
jsxFragment: config.build?.jsxFragment,
processEntrypoint: Boolean(config._processEntrypoint),
additionalModules: config._additionalModules,
processEntrypoint: Boolean(config.build?.processEntrypoint),
additionalModules: config.build?.additionalModules ?? [],
rules: config.build.moduleRules,
assets: config.legacy?.assets,
serveAssetsFromWorker: Boolean(
Expand Down
8 changes: 3 additions & 5 deletions packages/wrangler/src/api/startDevWorker/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export interface InputStartDevWorkerOptions {
/** The triggers which will cause the worker's exported default handlers to be called. */
triggers?: Trigger[];

// -- PASSTHROUGH -- FROM OLD CONFIG TO NEW CONFIG (TEMP)

/**
* Whether Wrangler should send usage metrics to Cloudflare for this project.
*
Expand All @@ -78,16 +76,16 @@ export interface InputStartDevWorkerOptions {
sendMetrics?: boolean;
usageModel?: "bundled" | "unbound";
_bindings?: CfWorkerInit["bindings"]; // Type level constraint for bindings not sharing names
_processEntrypoint?: boolean;
_additionalModules?: CfModule[];
// --/ PASSTHROUGH --

/** Options applying to the worker's build step. Applies to deploy and dev. */
build?: {
/** Whether the worker and its dependencies are bundled. Defaults to true. */
bundle?: boolean;

additionalModules?: CfModule[];

findAdditionalModules?: boolean;
processEntrypoint?: boolean;
/** Specifies types of modules matched by globs. */
moduleRules?: Rule[];
/** Replace global identifiers with constant expressions, e.g. { debug: 'true', version: '"1.0.0"' }. Only takes effect if bundle: true. */
Expand Down
6 changes: 2 additions & 4 deletions packages/wrangler/src/dev/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,13 @@ function DevSession(props: DevSessionProps) {
script: { path: props.entry.file },
directory: props.entry.directory,
_bindings: props.bindings,
_processEntrypoint: props.processEntrypoint,
_additionalModules: props.additionalModules,

triggers: [...routes, ...queueConsumers, ...crons],
env: props.env,
sendMetrics: props.sendMetrics,
usageModel: props.usageModel,
build: {
additionalModules: props.additionalModules,
processEntrypoint: props.processEntrypoint,
bundle: !props.noBundle,
findAdditionalModules: props.findAdditionalModules,
minify: props.minify,
Expand Down Expand Up @@ -467,7 +466,6 @@ function DevSession(props: DevSessionProps) {
props.env,
props.legacyEnv,
props.sendMetrics,
props.usageModel,
props.noBundle,
props.findAdditionalModules,
props.minify,
Expand Down

0 comments on commit 25e59ad

Please sign in to comment.