Closed FokkeZB closed 4 years ago
@FokkeZB Could you paste in the entire file your machine is in so I can check it out? You're very likely right.
It's something like:
const myMachine = Machine<Context, StateSchema>({ ... }, {...});
export default myMachine;
When I drop the last line it works fine.
@FokkeZB If you export it via a export const
, it'll work. Although you'll of course have to change your imports elsewhere.
We're going to be releasing a new version of the tool quite soon (before the end of August) which will have improved the process by which we fetch machines from code. This will change things in a few ways (we'll be closer to number 4 here)
I'll make sure we include this fix in that version. Is it a blocker to change your export default to export const?
@mattpocock awesome - I'll keep an eye on it and just refrain from export default
for now.
Much obliged. I'll keep this issue open to make sure we remember it.
@FokkeZB Could you try testing this on the 'next' branch on npm? Confident that what we've shipped there will fix this.
@mattpocock - confirmed! I get no more errors.
I see:
Although my code ends with:
This is because of:
https://github.com/mattpocock/xstate-codegen/blob/9dee84b1b3b3806de1cb215559397252f5ecf607/packages/xstate-compiled/src/getMachine.ts#L26
I guess it should also remove
default
followingexport
.