Type alias RequireFileCallback

RequireFileCallback: ((fullFilePath: string) => StoryFileCy | undefined)

Type declaration

    • (fullFilePath: string): StoryFileCy | undefined
    • A function which will gather the required storybook files. Often, require strings need to be hard coded. Ours looked like this

      const requireFileCallback: RequireFileCallback = (fullFilePath) => {
      const replaced = fullFilePath
      .replace("src/app/", "")
      .replace("src/common/", "");
      // We have to give webpack a little bit to hook onto, so we remove
      // the module entrypoint and include that directly as a string to `require`
      if (fullFilePath.startsWith("src/app")) {
      return require("app/" + replaced);
      }
      if (fullFilePath.startsWith("src/common")) {
      return require("common/" + replaced);
      }
      return;
      };

      Parameters

      • fullFilePath: string

      Returns StoryFileCy | undefined