How to make custom package use root node_modules

I want to use playwright in my application which based on theia-blueprint, everything is ok except the last step.
I copy playwright to a misc folder I create in the root.I find my playwright uses a node_mudules itself after yarn build.

I try the playwright in theia source, it use the root node_modules only a little different in itself.

if my playwright does not use root node_modules, there is some error, for example

so my problem is how to make my playwright use the root node_modules,
as you know all packages in blueprint theia-extensions folder use the same root node_modules,
I just do not know where to set them on a different folder for example in my custom misc folder.

Is your playwright package part of your lerna workspace? If not, that would explain why it creates its own node_modules directory. Note that you can only run yarn in the root of your workspace.

left is theia source code’s playwright, and right is mine. but I am not sure whether my playwright is in lerna workspace as you say. should I do some settings when creating a custom folder like misc to make it in lerna workspace?

There’s either a lerna.json file or an entry in the root package.json that you can use to add the project to the workspace.

I find the place. just in root package.json, I add misc/* to workspace, it is ok now