Skip to content

feat(cli): warn on createRequire packages missing from deployed images - #4851

Merged
matt-aitken merged 15 commits into
mainfrom
feat/cli-createrequire-deploy-warning
Aug 31, 2026
Merged

feat(cli): warn on createRequire packages missing from deployed images#4851
matt-aitken merged 15 commits into
mainfrom
feat/cli-createrequire-deploy-warning

Conversation

@matt-aitken

@matt-aitken matt-aitken commented Aug 31, 2026

Copy link
Copy Markdown
Member

Summary

The trigger.dev deploy and trigger.dev dev commands now warn (with the suggested fix) when your code loads a package through createRequire() that won't be available in the deployed image. Previously it would fail at runtime in production to load the package. Deploys also now show bundler warnings for your code instead of discarding them.

A package loaded with createRequire(import.meta.url)("pkg") is invisible to esbuild: the call is never resolved, so the package is neither bundled nor collected as an external to install in the deployed image. The deploy succeeds with zero diagnostics and the task fails at runtime with a module-not-found error, which can surface as something far more confusing when a library maps errors coarsely (a database driver loaded this way can look exactly like a connection failure). It also works fine in trigger dev because the local node_modules exists, making the production-only failure extra misleading.

Both deploy and dev builds now warn about this, pointing at the exact file and line, with a note showing the exact config that fixes it:

▲ [WARNING] "mssql" is loaded with createRequire() but won't be available in the deployed image, so loading it will fail at runtime. The bundler can't follow createRequire() calls, so "mssql" is neither bundled into your code nor installed in the image. [plugin create-require-collector]

    src/db.ts:12:14:
      12 │ const mssql = createRequire(import.meta.url)("mssql");
         ╵               ^

  To fix this, install "mssql" into the image by adding the additionalPackages build extension to your trigger.config.ts:

    import { additionalPackages } from "@trigger.dev/build/extensions/core";

    export default defineConfig({
      // ...
      build: {
        extensions: [additionalPackages({ packages: ["mssql"] })],
      },
    });

  Alternatively, replace the createRequire() call with a static import so the package is bundled. Docs: https://trigger.dev/docs/config/extensions/additionalPackages

In dev the message instead explains that the code works locally but deploys of it will fail, so the problem is caught while the code is being written rather than after a deploy.

How it works

An esbuild plugin scans the bundle's input files outside node_modules for string-literal specifiers passed to createRequire-created require functions: createRequire(...)("pkg"), const req = createRequire(...); req("pkg"), req.resolve("pkg"), aliased imports, namespace access, CJS destructuring, and dynamic import("node:module") bindings. Sources are parsed with @babel/parser (already in the dependency tree), so comments, strings, templates, regex literals and JSX can't confuse the scan; a file that fails to parse is skipped. Relative paths and node builtins never warn.

A usage only warns when the package will actually be missing from the image. On deploys the resolved manifest externals are the source of truth (extension-installed layers are already merged in when the warning runs); build.external alone deliberately does not suppress, because marking a package external installs nothing when nothing statically imports it. In dev, which predicts a future deploy, suppression additionally trusts what extensions declare they install, and stays silent entirely when that can't be determined (an extension hook throws, or an older @trigger.dev/build's additionalPackages predates the declaration hook), so dev never makes a false "deploys will fail" claim. additionalPackages declares its packages via a new diagnostics-only BuildExtension field, installedPackagesForTarget, which the bundler ignores: bundling output is unchanged for existing projects.

Detection is name-based, module-level, and deliberately per-file: computed specifiers, shadowed names, and require helpers imported from other files are not followed (those degrade to today's behavior, an unwarned runtime failure), and scanning is scoped to user code because bundled libraries legitimately use optional-require patterns that would drown real findings in noise. Packages named in build-layer install commands (RUN npm install ...) are suppressed individually.

Deploys also now surface esbuild's own bundle warnings for user files (for example require() with a non-literal argument), which were previously discarded on the deploy path; trigger dev already showed them.

Verification

Beyond the unit suite (54 tests, including real esbuild builds through the collector plugin), verified end to end against the hello-world reference project with the CLI linked to this branch:

  • trigger dev: a task loading mssql via createRequire produced the dev-phrased warning with the exact file:line code frame and the fix note during "Building local worker", and the local worker started normally. The project's real extensions (lightpanda, syncEnvVars, a custom inline extension) did not suppress it, and none of the project's other task files produced spurious warnings.
  • trigger deploy --dry-run, three passes: with the createRequire task it printed the deploy-phrased warning and still completed; after adding additionalPackages({ packages: ["mssql"] }) the warning disappeared and the build was clean; with the task removed and the config reverted, a pristine build produced zero warnings.

Packages loaded via createRequire(import.meta.url)("pkg") are invisible
to the bundler: they are neither bundled nor installed into the deployed
image, and the deploy succeeds silently before failing at runtime with a
module-not-found error. Deploy builds now scan user source files for such
loads, cross-check against the packages actually installed in the image,
and warn with file and line, suggesting the additionalPackages build
extension. Deploys also surface the bundler's own warnings for user files
instead of discarding them.
@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b1a98d5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
trigger.dev Patch
@trigger.dev/build Patch
@trigger.dev/core Patch
@internal/dashboard-agent Patch
@trigger.dev/python Patch
@trigger.dev/redis-worker Patch
@trigger.dev/schema-to-json Patch
@trigger.dev/sdk Patch
@internal/clickhouse Patch
@internal/llm-model-catalog Patch
@internal/metrics-pipeline Patch
@trigger.dev/rbac Patch
@internal/redis Patch
@internal/replication Patch
@internal/run-engine Patch
@internal/run-store Patch
@internal/schedule-engine Patch
@internal/tracing Patch
@internal/webhook-engine Patch
@internal/webhook-sources Patch
@internal/cache Patch
@trigger.dev/react-hooks Patch
@trigger.dev/rsc Patch
@trigger.dev/database Patch
@trigger.dev/otlp-importer Patch
@trigger.dev/sso Patch
@internal/testcontainers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c9ed74b-e8f7-42a1-b327-99b5444ca8a6

📥 Commits

Reviewing files that changed from the base of the PR and between 48e10d4 and 25df644.

📒 Files selected for processing (2)
  • packages/cli-v3/src/build/createRequireWarnings.test.ts
  • packages/cli-v3/src/build/createRequireWarnings.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (44)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (22, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (17, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (14, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (21, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (19, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (9, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (20, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (23, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (18, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (24, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (13, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (11, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (16, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (15, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (12, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 24)
  • GitHub Check: sdk-compat / Node.js 22.23 (warp-ubuntu-latest-x64-4x)
  • GitHub Check: e2e / 🧪 CLI v3 tests (warp-windows-latest-x64-8x - npm)
  • GitHub Check: sdk-compat / Node.js 24.18 (warp-ubuntu-latest-x64-4x)
  • GitHub Check: packages / 🧪 Unit Tests: Packages (3, 3)
  • GitHub Check: e2e / 🧪 CLI v3 tests (warp-ubuntu-latest-x64-4x - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (warp-ubuntu-latest-x64-4x - npm)
  • GitHub Check: sdk-compat / Cloudflare Workers
  • GitHub Check: sdk-compat / Node.js 26.4 (warp-ubuntu-latest-x64-4x)
  • GitHub Check: e2e / 🧪 CLI v3 tests (warp-windows-latest-x64-8x - pnpm)
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp (2, 2)
  • GitHub Check: sdk-compat / Bun Runtime
  • GitHub Check: runops-guard / runops-guard
  • GitHub Check: packages / 🧪 Unit Tests: Packages (2, 3)
  • GitHub Check: sdk-compat / Deno Runtime
  • GitHub Check: internal / 🧪 Unit Tests: Internal
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp (1, 2)
  • GitHub Check: packages / 🧪 Unit Tests: Packages (1, 3)
  • GitHub Check: fk-cascade-guard / fk-cascade-guard
  • GitHub Check: code-quality / code-quality
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (8)
We use vitest exclusively. **Never mock anything** - use testcontainers instead.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/cli-v3/src/build/createRequireWarnings.test.ts
**Prefer static imports over dynamic imports.** Only use dynamic `import()` when:

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/cli-v3/src/build/createRequireWarnings.test.ts
  • packages/cli-v3/src/build/createRequireWarnings.ts
Add crumbs as you write code — not just when debugging. Mark lines with

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/cli-v3/src/build/createRequireWarnings.test.ts
  • packages/cli-v3/src/build/createRequireWarnings.ts
Bundle worker code using the build system in `src/build/` based on configuration from `trigger.config.ts`

📄 CodeRabbit inference engine (packages/cli-v3/CLAUDE.md)

Files:

  • packages/cli-v3/src/build/createRequireWarnings.test.ts
  • packages/cli-v3/src/build/createRequireWarnings.ts
Use vitest for all tests in the Trigger.dev repository

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Files:

  • packages/cli-v3/src/build/createRequireWarnings.test.ts
Use function declarations instead of default exports

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Files:

  • packages/cli-v3/src/build/createRequireWarnings.test.ts
  • packages/cli-v3/src/build/createRequireWarnings.ts
Use types over interfaces for TypeScript

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Files:

  • packages/cli-v3/src/build/createRequireWarnings.test.ts
  • packages/cli-v3/src/build/createRequireWarnings.ts
When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs

📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)

Files:

  • packages/cli-v3/src/build/createRequireWarnings.test.ts
  • packages/cli-v3/src/build/createRequireWarnings.ts
🧠 Learnings (1)
📚 Learning: 2026-06-04T18:16:35.386Z
Learnt from: nicktrn
Repo: triggerdotdev/trigger.dev PR: 3836
File: apps/supervisor/src/backpressure/backpressureMonitor.ts:3-5
Timestamp: 2026-06-04T18:16:35.386Z
Learning: When reviewing TypeScript in this repo, apply the rule “prefer type aliases over interfaces” only to data/object shapes and union/intersection type modeling. If an interface is being used as a behavioral contract for collaborators to implement (e.g., method-shape interfaces that define required behavior, such as `BackpressureLogger` / `BackpressureSignalSource` in `apps/supervisor/src/backpressure/backpressureMonitor.ts`), keep it as an `interface` and do not flag it as a type-alias-vs-interface violation.

Applied to files:

  • packages/cli-v3/src/build/createRequireWarnings.ts
🪛 ast-grep (0.45.2)
packages/cli-v3/src/build/createRequireWarnings.ts

[warning] 79-82: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(
(?<![.\\w$])${createRequireCall}\\s*\\(\\s*${STRING_LITERAL}\\s*\\),
"g"
)
Note: [CWE-1333] Inefficient Regular Expression Complexity

(regexp-from-variable)


[warning] 88-91: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(
(?:const|let|var)\\s+(${IDENTIFIER})\\s*(?::\\s*[^=\\n;]+?)?\\s*=\\s*${createRequireCall}(?!\\s*\\(),
"g"
)
Note: [CWE-1333] Inefficient Regular Expression Complexity

(regexp-from-variable)


[warning] 127-130: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(
import\\s*(?:type\\s+)?(?:(${IDENTIFIER})\\s*,\\s*)?\\{([^}]*)\\}\\s*from\\s*${MODULE_SPECIFIER},
"g"
)
Note: [CWE-1333] Inefficient Regular Expression Complexity

(regexp-from-variable)


[warning] 131-134: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(
(?:const|let|var)\\s*()\\{([^}]*)\\}\\s*=\\s*require\\s*\\(\\s*${MODULE_SPECIFIER}\\s*\\),
"g"
)
Note: [CWE-1333] Inefficient Regular Expression Complexity

(regexp-from-variable)


[warning] 145-145: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(^\\s*createRequire\\s*(?:(?:as\\s+|:\\s*)(${IDENTIFIER}))?\\s*$)
Note: [CWE-1333] Inefficient Regular Expression Complexity

(regexp-from-variable)


[warning] 156-156: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(import\\s+(${IDENTIFIER})\\s+from\\s*${MODULE_SPECIFIER}, "g")
Note: [CWE-1333] Inefficient Regular Expression Complexity

(regexp-from-variable)


[warning] 157-157: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(import\\s*\\*\\s*as\\s+(${IDENTIFIER})\\s+from\\s*${MODULE_SPECIFIER}, "g")
Note: [CWE-1333] Inefficient Regular Expression Complexity

(regexp-from-variable)


[warning] 158-161: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(
(?:const|let|var)\\s+(${IDENTIFIER})\\s*=\\s*require\\s*\\(\\s*${MODULE_SPECIFIER}\\s*\\),
"g"
)
Note: [CWE-1333] Inefficient Regular Expression Complexity

(regexp-from-variable)

🔇 Additional comments (7)
packages/cli-v3/src/build/createRequireWarnings.ts (5)

25-26: LGTM!


40-96: LGTM!


116-172: LGTM!


183-293: LGTM!


336-336: LGTM!

Also applies to: 366-369

packages/cli-v3/src/build/createRequireWarnings.test.ts (2)

168-240: LGTM!


297-310: LGTM!


Walkthrough

Deploy builds scan user source for packages loaded through createRequire(). The build filters unavailable packages using externals and target-installed packages, then logs source locations with configuration guidance. Bundle results retain esbuild warnings. Dev sessions also report usages unavailable after deployment. Tests cover scanning, filtering, warning generation, package extraction, and esbuild integration.

Merge Risk: 🔵 Low · up to 25df6

Configured externals can suppress the new warning without adding a createRequire-only package to deployed dependencies, so affected deployments may still fail at runtime without a diagnostic. The PR is mergeable with explicit owner awareness or follow-up on this bounded deployment risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the primary change: warnings for packages loaded through createRequire() that are missing from deployed images.
Description check ✅ Passed The description provides a detailed summary, implementation scope, configuration guidance, testing coverage, and end-to-end verification. It does not use every template section, including the issue re…
Full details: Description check

Explanation

The description provides a detailed summary, implementation scope, configuration guidance, testing coverage, and end-to-end verification. It does not use every template section, including the issue reference, checklist, changelog, and screenshots, but the core PR information is complete.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-createrequire-deploy-warning

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

…nt noise

Match createRequire(fileURLToPath(import.meta.url)) by allowing one level
of nested parens in the argument, skip hits on commented-out lines, and
only scan files that import the module builtin so unrelated functions
named createRequire never warn.
@pkg-pr-new

pkg-pr-new Bot commented Aug 31, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@08de7db

trigger.dev

npm i https://pkg.pr.new/trigger.dev@08de7db

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@08de7db

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@08de7db

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@08de7db

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@08de7db

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@08de7db

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@08de7db

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@08de7db

commit: 08de7db

devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

…warning

The warning now carries a note with a copy-pasteable additionalPackages
snippet naming trigger.config.ts, instead of only linking the docs.
…eploys won't have

The same createRequire scan now runs during dev builds and warns on every
build that the package works locally but will be missing from the deployed
image, so the problem surfaces while writing the code instead of after a
deploy. additionalPackages declares its packages as deploy externals, so a
configured fix suppresses the warning in both dev and deploy.
devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

…tics-only suppression

Adds the scan/suppression halves of the dev warning (the devSession wiring
landed in the previous commit): nested-arg matching feeds both targets, and
a usage only warns when the package is missing from the resolved externals
and every configured external. additionalPackages declares its packages via
a new diagnostics-only BuildExtension field, installedPackagesForTarget, so
a configured fix silences the warning without changing bundling output.
coderabbitai[bot]

This comment was marked as resolved.

…uire detection

Scanning now runs on a comment-stripped, template-blanked copy of the
source (string-aware, offsets preserved), so commented-out code never
registers require names, closed inline comments don't hide real calls,
and // inside a string is not mistaken for a comment. Calls are only
recognized when the createRequire binding provably comes from the module
builtin (named import, namespace member, or CJS destructure), typed
require variables and two-level-nested createRequire arguments are
matched, whitespace before require( is accepted, and the node_modules
skip matches path segments instead of substrings.
devin-ai-integration[bot]

This comment was marked as resolved.

…anner

Deploy suppression now uses only the manifest externals (the actual image
contents when the warning runs); configured externals like build.external
no longer silence warnings for packages that are never installed. Dev
suppression adds extension-declared packages and stays silent when those
can't be determined (a hook throws, or an older additionalPackages lacks
the declaration hook), so it never makes a false deploys-will-fail claim,
and additionalPackages skips unparseable entries instead of throwing into
dev startup. The lexer blanks regex-literal bodies and records quoted
string spans so string contents can't false-positive, dynamic
import("node:module") bindings and declare-then-assign variables are
recognized, require functions exported from one file and imported into
another are followed, dev rebuilds cache per-file scans by mtime and stat
in parallel, and the dev/deploy pipelines share one warning builder.
Completes the change described in the prior commit message: the lexer,
binding, cross-module and caching work in the scanner, the corrected
suppression sources, and the never-throw additionalPackages declaration.
devin-ai-integration[bot]

This comment was marked as resolved.

… createRequire warning

Dev warnings stay silent when any hook-bearing extension declares no
installed packages (layer installs are invisible in dev), and both targets
stay silent when a build-layer command runs a JS package manager, since
those installs never reach the manifest externals. The division-vs-regex
heuristic handles postfix increments, non-null assertions and JSX closers,
query-suffixed metafile inputs are scanned once, cross-file require
functions match only when the import path resolves to the exporting file,
file reads are concurrency-capped with per-file scans reused instead of
recomputed, helper duplication with externals.ts is removed, and the
changeset is rewritten as a single user-facing sentence.
devin-ai-integration[bot]

This comment was marked as resolved.

…nstall-command suppression

Replaces the hand-rolled lexer and regex scanner with a @babel/parser scan
(typescript/jsx with fallbacks, parse failures skip the file), eliminating
the comment/string/regex/JSX misparse class outright; template-literal
specifiers now also match. Cross-file require functions resolve through
the metafile's own import records, so index files and path aliases work.
Build-layer install commands suppress only the packages they actually
name instead of silencing the whole feature, first-party extensions that
install no node packages declare that so dev warnings stay active for
them, extension matchers are computed before internal extensions are
prepended, deploy warning output honors plain mode and keeps
location-less messages with a segment-exact node_modules filter, and
additionalPackages only claims packages for the deploy target.
…ackagesForTarget

externalsForTarget is synchronous; the example showed async, which the
build consumes incorrectly and TypeScript rejects. Adds a section for the
new diagnostics-only installedPackagesForTarget hook.
devin-ai-integration[bot]

This comment was marked as resolved.

…anner edge fixes

Inverts the extension-declaration default: an extension that declares no
installed packages is assumed to install none, so dev warnings stay live
for third-party and yet-to-declare extensions instead of silently
disabling the feature (proven twice by first-party sweeps missing
extensions). The incomplete guard remains only where false warnings are
genuinely likely: a throwing declaration hook, or an additionalPackages
extension too old to declare, and the engine-only prisma mode now
declares @prisma/engines. Also: specifier-form exports (export { req })
are followed cross-file, npm-alias install tokens suppress the aliased
name, literal Windows path specifiers never warn, the bare-specifier
check reuses isBareModuleImport, collector usages swap atomically per
build, exported-name mention checks use identifier boundaries, and
signature-miss re-reads run under the concurrency cap with failures
logged.
devin-ai-integration[bot]

This comment was marked as resolved.

… scanning

Removes cross-file require-function following and its collector machinery
(two-phase scan, exports-signature cache, metafile import resolution,
export-specifier tracking): a require helper imported from another module
is no longer followed, which just leaves that pattern unwarned as before
this feature. Each file now scans independently with a simple per-file
mtime cache. With undeclared extensions assumed to install nothing, the
empty installedPackagesForTarget stubs on built-in extensions are removed
too; only extensions that actually install packages declare
(additionalPackages and the engine-only prisma mode).
Files using decorators parse instead of being skipped, and npm install -g
commands no longer suppress the warning for packages task code can't
resolve.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 2 new potential issues.

Devin Review

Comment thread packages/cli-v3/src/build/createRequireWarnings.ts
Comment thread packages/cli-v3/src/build/createRequireWarnings.ts
@matt-aitken
matt-aitken enabled auto-merge (squash) August 31, 2026 16:59
@matt-aitken
matt-aitken merged commit 23016de into main Aug 31, 2026
70 checks passed
@matt-aitken
matt-aitken deleted the feat/cli-createrequire-deploy-warning branch August 31, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants