Skip to content

fix(docs): add build path to nodePaths for colocated hooks#6658

Open
benvp wants to merge 1 commit into
phoenixframework:mainfrom
benvp:docs/custom-build-colocated-hooks
Open

fix(docs): add build path to nodePaths for colocated hooks#6658
benvp wants to merge 1 commit into
phoenixframework:mainfrom
benvp:docs/custom-build-colocated-hooks

Conversation

@benvp

@benvp benvp commented Apr 17, 2026

Copy link
Copy Markdown

Since the introduction of colocated hooks in v1.8 the example for a custom build.js file requires the build path to be present as well. If it is not present, the build of the assets will fail with a resolve error Could not resolve "phoenix-colocated/<app>"

The default :esbuild config already includes the build path by using Mix.project.build_path()

@SteffenDE SteffenDE left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe for that to work, you'd also need to adjust the watcher to explicitly pass env: %{"MIX_ENV" => to_string(Mix.env())} and also pass MIX_ENV in the configured aliases.

Otherwise, unless you manually set MIX_ENV, it won't be set in the build script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants