Hello,
Iβm having an issue with a local build plugin in a pnpm workspace project with different folders for different sites. The local build plugin does a very simple job. During preBuild it pulls some serialization files, pushes new ones and onError reverts them. This part works fine.
I also have cypress-plugin which runs netlify dev during preBuild and perform some tests. If all is ok build starts and continues.
My project folder hierarchy is as follows
- Root
- lib
- sites
- mysite
- cypress
- plugins
- uniform-build-events
- index.js
- manifest.yml
- uniform-build-events
- netlify.toml
- package.json
- mysite
I have following context definition in Netlify.toml
[context."fix/dev-failing"]
command="pnpm build"
[[context."fix/dev-failing".plugins]]
package = "/plugins/uniform-build-events"
[context."fix/dev-failing".plugins.inputs]
enable=true
[[context."fix/dev-failing".plugins]]
package = "netlify-plugin-cypress"
[context."fix/dev-failing".plugins.inputs]
enable = false
[context."fix/dev-failing".plugins.inputs.preBuild]
enable = true
spec = "cypress/e2e/*.feature"
start= "netlify dev"
wait-on= "http://localhost:8888"
wait-on-timeout="120"
The problem is, when βnetlify devβ is run during cypress plugin it fails with βPlugin could not be found using local pathβ error
In logs I see
4:32:14 PM: Next.js cache restored.
4:32:14 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
4:32:14 PM: β
4:32:14 PM: (@netlify/plugin-nextjs onPreBuild completed in 415ms)
4:32:14 PM: β
4:32:14 PM: ./plugins/uniform-build-events (onPreBuild event)
4:32:14 PM:
........
4:32:26 PM: (./plugins/uniform-build-events onPreBuild completed in 10.2s)
4:32:26 PM:
4:32:26 PM: netlify-plugin-cypress (onPreBuild event)
4:32:26 PM: β
4:32:34 PM: [STARTED] Task without title.
4:32:36 PM: [SUCCESS] Task without title.
4:32:36 PM: DevTools listening on ws://127.0.0.1:39439/devtools/browser/767febfa-fb9c-4878-9113-1eca73ee2d57
4:32:37 PM: waiting on "http://localhost:8888" with timeout of 120 seconds
4:33:16 PM: β Netlify Dev β
4:33:16 PM: β Ignored netlify.toml file env var: CYPRESS_CACHE_FOLDER (defined in process)
4:33:16 PM: β Ignored netlify.toml file env var: TERM (defined in process)
.............
4:33:16 PM: Configuration error
4:33:16 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
4:33:16 PM: β
4:33:16 PM: Error message
4:33:16 PM: Plugin could not be found using local path: ./plugins/uniform-build-events
4:33:16 PM: Cannot find module "./plugins/uniform-build-events"
4:33:16 PM: Require stack:
4:33:16 PM: - /opt/build/repo/node_modules/.pnpm/@netlify+build@29.33.5_@types+node@20.6.3/node_modules/@netlify/build/lib/utils/resolve.js
Iβve tried defining package as
package = β/plugins/uniform-build-eventsβ or
package = β./plugins/uniform-build-eventsβ
onPreBuild it runs properly but netlify dev complains.
I have 2 questions.
Is there a parameter to disable plugins when running netlify dev command?
Why netlify dev command canβt find the plugin but build finds?
If it helps, here is a deploy id that fails. 65c3a23ff0a8d40008580918
Regards,
Burak