Skip to content

Failed to fetch dynamically imported module: http://localhost:6006/.storybook/preview.ts #58

Description

@mohsennrs

I followed the document for keycloakify-starter integration with NX monorepo. Now when I run the storybook from the root of my NX project I get this error:

`17:33:52 [vite] Internal server error: /home/mohsen/code/M2-livefarm/livefarm-monorepo/apps/keycloakify-starter/.storybook/preview.ts: Unexpected token, expected "from" (1:12)

1 | import type { Preview } from "@storybook/react";
| ^
2 |
3 | const preview: Preview = {
4 | parameters: {
Plugin: storybook:react-docgen-plugin
File: /home/mohsen/code/M2-livefarm/livefarm-monorepo/apps/keycloakify-starter/.storybook/preview.ts:1:12
1 | import type { Preview } from "@storybook/react";
| ^
2 |
3 | const preview: Preview = {`

Project structure

My NX workspace includes:

A Next.js application

A React Native application

A shared component library with React

What I’m trying to do

I want to use the shared components in the Keycloakify pages. For that to work, I need to run Storybook from the root of the monorepo, not just within the apps/keycloakify-starter directory.

Running Storybook from within the apps/keycloakify-starter app does solve the issue, but it doesn’t meet my requirements.

Expected behavior

Running Storybook from the root of the NX workspace should work with the Keycloakify starter, enabling access to shared libraries.

Environment

NX Monorepo

Keycloakify starter

Storybook (React)

Vite

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions