react-d3-components icon indicating copy to clipboard operation
react-d3-components copied to clipboard

Can't add property context, object is not extensible

Open joaomilho opened this issue 9 years ago • 5 comments

Hey guys, I'm using React 0.13.1, along with Babel+Browserify. My source is:

let React = require('react');
let ReactD3 = require('react-d3-components');
let AreaChart = ReactD3.AreaChart;

let data = [
  {
    label: 'somethingA',
    values: [{x: 0, y: 2}, {x: 1.3, y: 5}, {x: 3, y: 6}, {x: 3.5, y: 6.5}, {x: 4, y: 6}, {x: 4.5, y: 6}, {x: 5, y: 7}, {x: 5.5, y: 8}]
  },
  {
    label: 'somethingB',
    values: [{x: 0, y: 3}, {x: 1.3, y: 4}, {x: 3, y: 7}, {x: 3.5, y: 8}, {x: 4, y: 7}, {x: 4.5, y: 7}, {x: 5, y: 7.8}, {x: 5.5, y: 9}]
  }
];

React.render(<AreaChart
  data={data}
  width={400}
  height={400}
  margin={{top: 10, bottom: 50, left: 50, right: 10}}/>,
  document.body);

And I compile it with:

browserify src/file.es6 -t babelify --outfile dist/file.js

I see everything getting compiled correctly, but I got the "Can't add property context, object is not extensible". Any idea?

joaomilho avatar Apr 04 '15 10:04 joaomilho

There's something really wrong here. When I opened the package.json of your lib, the version is 0.4.6 and react's version is 0.12.2, while on Github you have react 0.13.1 but the SAME version of the lib. Whaaaat?

joaomilho avatar Apr 04 '15 10:04 joaomilho

Amazing, now I installed directly from github. The package points to the right React version (0.13.1) but now both webpack and browserify can't find the lib, since there's no index.js and package points to lib/index.js, which doesn't exist (as far as I understand is removed before build). ......

joaomilho avatar Apr 04 '15 10:04 joaomilho

Hey! Thanks for the report! The version on Github has React 0.13.1 since some days ago but I did not yet release a new NPM version. I will publish the new version first thing monday morning! In the meanwhile what you can do is git clone this repository and then npm install /path/to/repository, then the lib folder will be created and installed into your project. Hope that helps!

codesuki avatar Apr 04 '15 14:04 codesuki

Hey, thanks for the response and sorry for the frustration :D. Cloning worked. LMK when there's a new version.

joaomilho avatar Apr 05 '15 09:04 joaomilho

Glad it worked out. New npm version uploaded! Please have a try :)

codesuki avatar Apr 06 '15 03:04 codesuki