Custom Plugin: Component and Content-Type creation by startup

I correct you are right in the database the component appears correctly. As soon as I switch to the Content Type Builder in the admin, only a white page appears. When I restart the server, it no longer starts up with the following message:

TypeError: Cannot read properties of undefined (reading 'attributes')
  const data = {
    collectionName: "components_test_bars",
    info: {
      displayName: "bar",
    },
    options: {},
    attributes: {
      foo: {
        type: "string",
      },
    },
  };
  strapi.components["test.bars"] = data;