I have a class in /cli package to do some of my work. This class has an init method which must run whenever server starts. So I put one line of code in /cli/src/Server.ts file and everything works perfectly. But the problem is, I want to use this class in /packages/nodes-base dir, so when I import it, the nodes-base cannot be built.
In short: How can I import and use other files from other packages ?
so n8n’s monorepo has dependencies flowing in one direction - nodes-base cant import from cli because cli depends on nodes-base, not the other way around. what you probably want is to move that shared class into a package both can depend on, like @n8n/workflow or create a new shared package in /packages.
if you absolutely need that class in nodes, you could extract it to /packages/workflow/src or another lower-level package, then import it from both cli and nodes-base. what’s the class doing exactly? might help figure out where it should live