Skip to content

Conversation

@JakeChampion
Copy link
Contributor

@JakeChampion JakeChampion commented Nov 7, 2025

Adds the --node-modules-dir=false flag to deno bundle commands in both tarball and eszip bundling formats. This ensures consistent handling of node modules during edge function bundling and updates related tests to reflect the new flag usage. The change improves reliability of the bundling process by explicitly disabling node modules directory handling.

This will stop our bundling step from accidentally adding a .deno folder into the node_modules folder, which was causing issues for builds which use a cached node_modules folder

This was a bit difficult to test out locally, I instead did a manual test using buildbot via https://github.com/netlify/buildbot/pull/3874 and then making a site's build use this custom buildbot image

@JakeChampion JakeChampion force-pushed the jake/build branch 3 times, most recently from aaea002 to 962297f Compare November 10, 2025 15:00
@JakeChampion JakeChampion changed the title fix: update deno run command to set node-modules-dir to manual fix: update deno run command to set node-modules-dir to false Nov 10, 2025
@JakeChampion JakeChampion marked this pull request as ready for review November 10, 2025 15:03
@JakeChampion JakeChampion requested a review from a team as a code owner November 10, 2025 15:03
@JakeChampion JakeChampion changed the title fix: update deno run command to set node-modules-dir to false fix: update deno run commands to set node-modules-dir to false Nov 10, 2025
(Netlify Build completed in 1ms)␊
Build step duration: Netlify Build completed in 1ms`

## In integration dev mode, install local plugins and install the integration when forcing build
Copy link
Member

Choose a reason for hiding this comment

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

How come this is getting removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test does not exist - which is why the snapshot was removed when I regenerated snapshots

importMapData,
vendorDirectory,
}
const flags = ['--allow-all', '--no-config', `--import-map=${bundlerImportMap}`]
Copy link
Member

Choose a reason for hiding this comment

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

Is it necessary to do this on the ESZIP flow as well? I suppose it shouldn't have any negative impact since in this case we're only running the ESZIP bundler script and we won't find any node modules in there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this is required yeah, the .deno folder was being made until I also added this flag here

Reorders the code to add vendor import maps before bundle generation starts. This ensures the import map is properly initialized with vendor dependencies before any bundling logic executes, preventing potential issues with missing dependencies during the bundling process.
Enables manual node modules directory handling in both eszip and tarball bundling formats. This change provides more granular control over how node modules are resolved during the bundling process, ensuring consistent behavior across different bundling targets.
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.

3 participants