question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot add property components, object is not extensible

See original GitHub issue

Describe the bug Installed @storybook/addon-info to work with a Vue app, but I’ve been unable to get it working as it seems to break storybook as it renders the error Cannot add property components, object is not extensible.

I’ve tried to use addDecorator in config.js (breaks all stories) and also inside a single story (breaks just that story).

Also uninstall all other addon’s and went back to a clean storybook install but still running into the same issue.

Screenshots image

Code snippets

// .storybook/config.js

import '@storybook/addon-console';
import { addDecorator, configure } from '@storybook/vue';
import { withInfo } from '@storybook/addon-info';

// Import plugins.
import Vue from 'vue';
import Vuex from 'vuex';

// Install plugins.
Vue.use(Vuex);

// Storybook Info Addon
// https://github.com/storybooks/storybook/tree/master/addons/info#storybook-info-addon
addDecorator(withInfo);

// Load stories, display order determined by import order.
const req = require.context('../src', true, /.stories.js$/);
function loadStories() {
  req.keys().forEach((filename) => req(filename))
}

configure(loadStories, module);
// my.stories.js

import { storiesOf } from '@storybook/vue';

import Button from './button';

storiesOf('Components/Atoms/Button', module)
  .add('default', () => ({
    template: `
      <Button @onClick="onClick">Default Button</Button>
    `,
    components: { Button },
  }));
// button.vue

<template>
  <Component
    :is="element"
    :class="buttonClasses"
    v-bind="attributes"
    @click="$emit('onClick')"
  >
    <slot />
  </Component>
</template>

<script>
export default {
  name: 'Button',
  props: {
    href: { type: String, default: '' },
    primary: { type: Boolean, default: false },
  },
  computed: {
    element() {
      return this.href ? 'a' : 'button';
    },
    buttonClasses() {
      return {
        button: true,
        primary: this.primary,
        secondary: !this.primary,
      };
    },
    attributes() {
      return {
        ...(this.href ? { href: this.href, target: '_blank' } : {}),
      };
    },
  },
};
</script>

System:

  • OS: MacOS
  • Device: Macbook Pro 2018
  • Browser: chrome
  • Framework: vue
  • Addons: addon-info
  • Version: 4.0.4

Would absolutely ❤️ to use this plugin as it’s one of the main attractions to storybook for us. Please let me know if there is anything I can to do to help.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
lloydjatkinsoncommented, Nov 29, 2018

I think this needs to be noted somewhere in the docs - spent a few hours debugging this not realising it didn’t support Vue.

3reactions
igor-dvcommented, Nov 12, 2018

The official addon-info is platform specific, and currently has only React implementation https://github.com/storybooks/storybook/blob/next/ADDONS_SUPPORT.md

But you can use this one https://github.com/pocka/storybook-addon-vue-info =)

Read more comments on GitHub >

github_iconTop Results From Across the Web

React : cannot add property 'X', object is not extensible
I want to add a property 'LegendPosition' with the props in this component. I am unable to do that. Please help me with...
Read more >
Cannot add property _children, object is not extensible
I am trying to work with lwc tree-grid and move the results returned from my query display there related data. However it looks...
Read more >
cannot add property _ctor, object is not extensible - You.com
Uncaught error "Cannot add property _Ctor, object is not extensible". As of v2.4.0, ES modules are auto-resolved when used as dynamic components e.g.....
Read more >
React "Cannot add property _gsap, object is not extensible"
I want to implement it to my React / Next.js project. I wanted to have gsap animation codes be seperate from my page/component...
Read more >
Cannot add property <propName>, object is not extensible
It's a ridicolous problem. Sometimes a top-level property in one of my React components (not part of the state) gets locked, sometimes a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found