Hi thanks for your time.
What are you trying to do?
I have inherited a codebase and am trying to create a new project from it.
What have you tried so far?
I thought if i duplicate the project, then use plasmic sync to pull in all the code into a development branch I would be able to set it up clean and proper. But when running plasmic sync i get many importPath issues.
I have since added the importPath to all the components that have errors in the plasmic-init.ts file, but the sync still fails with
Plasmic error: Encountered code component "CustomTab" that was not registered with an importPath, so we don't know where to import this component from. Please see https://docs.plasmic.app/learn/code-components-ref/Error: Encountered code component "CustomTab" that was not registered with an importPath, so we don't know where to import this component from. Please see https://docs.plasmic.app/learn/code-components-ref/
These are the relevant excerpts from the plasmic-init.ts
import CustomTab from './components/custom-plasmic-components/CustomTab'
PLASMIC.registerComponent(CustomTab, {
name: 'CustomTab',
importPath: './src/components/custom-plasmic-components/CustomTab.tsx',
isDefaultExport: true,
props: {
defaultActiveTab: 'number',
tabsBarStyle: 'object',
allTabsTitle: {
type: 'array',
itemType: {
type: 'object',
fields: {
title: 'string',
},
},
},
children: {
type: 'slot',
},
},
})
I have also tried removing the plasmic-init and setting all the imports in plasmic-host file instead and then using
import { PlasmicCanvasHost, registerComponent } from '@plasmicapp/react-web/lib/host';
import CustomTab from '../components/custom-plasmic-components/CustomTab'
registerComponent(CustomTab, {
name: 'CustomTab',
importPath: './custom-plasmic-components/CustomTab.tsx',
isDefaultExport: true,
props: {
defaultActiveTab: 'number',
tabsBarStyle: 'object',
allTabsTitle: {
type: 'array',
itemType: {
type: 'object',
fields: {
title: 'string',
},
},
},
children: {
type: 'slot',
},
},
})
But i get the same errors when running plasmic sync. This is the same for all of the components registered in the plasmic init file.
Inititally there was no plasmic.json, but after the sync it looks like this:
{
"platform": "nextjs",
"code": {
"lang": "ts",
"scheme": "blackbox",
"reactRuntime": "classic"
},
"style": {
"scheme": "css-modules",
"defaultStyleCssFilePath": ""
},
"images": {
"scheme": "public-files",
"publicDir": "../public",
"publicUrlPrefix": "/"
},
"tokens": {
"scheme": "theo",
"tokensFilePath": "plasmic-tokens.theo.json"
},
"srcDir": "src/components",
"defaultPlasmicDir": "./plasmic",
"projects": [],
"globalVariants": {
"variantGroups": []
},
"wrapPagesWithGlobalContexts": true,
"nextjsConfig": {
"pagesDir": "../pages"
},
"cliVersion": "0.1.331",
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.331/dist/plasmic.schema.json"
}
Thanks again for your help.
Relevant links:
- My project: Plasmic