Skip to content

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

Open
benvp wants to merge 1 commit intophoenixframework: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 intophoenixframework:mainfrom
benvp:docs/custom-build-colocated-hooks

Conversation

@benvp
Copy link
Copy Markdown

@benvp benvp commented Apr 17, 2026

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()

Copy link
Copy Markdown
Contributor

@SteffenDE SteffenDE left a comment

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants