How to import project with code components?

I’m using the imported projects feature. The project I’m importing contains code components. Naturally this leads to errors, since the code for these components doesn’t exists in the project im importing in. Are there any guides on how to solve this?

Hey @balanced_crawdad, the current workaround for that is to use the same app host for both projects. That way imported code components will work as expected.

But not, when using the actual code or hosting the generated app somewhere, right?

Yes, unfortunately we don’t support using code components from different hosts in the same project - studio can only work with code components from the current project’s host.

If you register the same code components from the imported project in your other project/host, things should work.

And yes, when you are using the “real” generated app, it’s not using the app host at all. Instead, we’ll use the importPath that you specified when you registerComponent() to find your code components in generated code.

Alternativly, can somehow choose which pages should be generated using codegen? Then we could just have all pages in one project but deploy just some pages under a specific domain.

Another question that arises when going that route: Can I copy a page from one project into another project without using the “Imported projects” feature?

Hi @balanced_crawdad - it’s not possible to choose which pages will be generated using codegen and it’s not possible to copy a page from one project into another without using “import project” at the moment. I’m not sure if I understand well your use case, but if you were willing to use one project to make different sites, can’t you just use the same host for several projects? That way you can import code components without any problems. The host app doesn’t need to contain anything besides the registered components.

Using code components import from another project inside Plasmic Studio works great, but when using codegen I get a “ModuleNotFoundError” error because the component doesn’t exist at the specified importPath . Currently that would mean copying over our code or use a npm package to distribute our code components to all Plasmic projects. I haven’t had time to setup private packages for our org yet, but maybe that’s the cleanest way to go.