Open danielkcz opened 4 years ago
In the branch use-paths
I tried a slightly different approach with path aliases, but the outcome is the same.
Specifically, it means I import from ~machinery/xstate/react
and that alias is defined in tsconfig. It also utilizes outDir
.
Oh wait, I just noticed that @xstate/compiled
has been written to modules/machinery/node_modules
instead of a root one. Well, that explains it...
I have figured an ugly workaround. In the modules/web/package.json
I've added this and it works.
"@xstate/compiled": "file:../machinery/node_modules/@xstate/compiled",
I am not sure how a proper solution should look like.
Well, that wasn't the right workaround either. When I modified that machine it went haywire.
So I ended up moving codegen execution to root. It will correctly output to root node_modules
and behaves correctly.
I suppose ultimately it's the right solution and documenting it should be good enough.
OK, to fix this we should probably add a --cwd
flag that allows you to pick the current working directory. This wouldn't be too hard to implement/document. What do you think?
Yea, that could certainly help as well.
@FredyC Here's a PR which might help with the above:
Here is the minimal repo that shows this problem: https://github.com/FredyC/xstate-codegen-monorepo
I have no idea why it should be a problem considering
@xstate/compiled
exists in rootnode_modules
.