Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: loading storybook/drupal-addon twice #27

Merged
merged 1 commit into from
Mar 2, 2023
Merged

Conversation

deviantintegral
Copy link
Member

When loading, in the browser console you get:

storybook/drupal-addon was loaded twice, this could have bad side-effects

After tracing through webpack, we can see the last two lines:

    __webpack_exec__("./node_modules/@storybook/core-client/dist/esm/manager/index.js"),
    __webpack_exec__("./node_modules/@storybook/addon-links/manager.js"),
    __webpack_exec__("./node_modules/@storybook/addon-docs/manager.js"),
    __webpack_exec__("./node_modules/@storybook/addon-controls/manager.js"),
    __webpack_exec__("./node_modules/@storybook/addon-actions/manager.js"),
    __webpack_exec__("./node_modules/@storybook/addon-backgrounds/manager.js"),
    __webpack_exec__("./node_modules/@storybook/addon-viewport/manager.js"),
    __webpack_exec__("./node_modules/@storybook/addon-toolbars/manager.js"),
    __webpack_exec__("./node_modules/@storybook/addon-measure/manager.js"),
    __webpack_exec__("./node_modules/@storybook/addon-outline/manager.js"),
    __webpack_exec__("./node_modules/@lullabot/storybook-drupal-addon/dist/esm/preset/manager.js"),
    __webpack_exec__("./node_modules/@lullabot/storybook-drupal-addon/manager.js")));

In contrast, there's no includes for the previous addons even though they have similar imports and requires.

It looks like we don't need to add our manager by hand at all. Removing this function fixes the error. While it doesn't cause any negative effects that I can tell, it also doesn't fix any of the other issues I'm currently debugging. Still, a warning like this seems like it could easily send those debugging issues down the wrong path.

@deviantintegral deviantintegral requested a review from e0ipso March 1, 2023 17:25
Copy link
Member

@e0ipso e0ipso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great find. I wonder if we should also submit this to the official @storybook/addon-kit.

https://github.com/storybookjs/addon-kit/blob/main/preset.js

@e0ipso e0ipso merged commit a3fbc07 into main Mar 2, 2023
@e0ipso e0ipso deleted the fix-duplicate-include branch March 2, 2023 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants