Skip to content

Storybook tries to bundle server-only plugins into client #309

@lilioid

Description

@lilioid

Version

@nuxtjs/storybook: 4.1.1
nuxt: 2.15.7

Reproduction Link

The repository ftsell/BorrowList300 includes two tagged commits.
The first is at a state in which storybook fails to compile while the second has a workaround commit applied.

Steps to reproduce

  1. Add a server-only-plugin that really only compiles when loaded on the server.
    In my case this is a plugin responsible for hosting the project's backend because it requires modules for the database layer that are not available for the browser.

    This plugin should import its dependencies at the top of the file before checking whether it is executing in a server context.
    This is fine during normal nuxt execution because nuxt only includes the plugin in the server bundle.

  2. Try to start nuxt storybook

What is Expected?

nuxt storybook should start just as well as the normal nuxt server does.

What is actually happening?

In my case nuxt storybook exits with 'Nuxt Fatal error' and a huge stack trace because it cannot bundle a module that was compile using node-gyp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions