diff --git a/.babelrc b/.babelrc index d7aa9ca..add9366 100644 --- a/.babelrc +++ b/.babelrc @@ -1,20 +1,6 @@ { "presets": [ - [ - "es2015", - { - "modules": false - } - ], - "react", - "stage-0" - ], - "env": { - "start": { - "presets": ["react-hmre"] - }, - "test": { - "presets": ["es2015", "react", "stage-0"] - } - } + "env", + "react" + ] } diff --git a/package.json b/package.json index f183cd8..2d256d2 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "prepublish": "babel ./src --out-dir ./lib --plugins=transform-class-properties,transform-react-jsx --presets=env", - "test": "jest" + "test": "BABEL_ENV=test jest" }, "repository": { "type": "git", @@ -32,7 +32,7 @@ "babel-cli": "^6.26.0", "babel-core": "^6.26.0", "babel-eslint": "^6.1.2", - "babel-jest": "^22.4.1", + "babel-jest": "^22.4.3", "babel-loader": "^7.1.2", "babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-react-jsx": "^6.24.1", @@ -52,6 +52,7 @@ "react": "^15.5.4", "react-dom": "^15.5.4", "react-test-renderer": "^16.2.0", + "regenerator-runtime": "^0.11.1", "webpack": "^3.6.0", "webpack-dev-server": "^2.9.1" }, diff --git a/src/index.js b/src/index.js index a5fff66..7c204c0 100644 --- a/src/index.js +++ b/src/index.js @@ -2,6 +2,10 @@ import hljs from 'highlight.js'; import React from 'react'; class Highlight extends React.Component { + constructor(props) { + super(props) + this.setEl = this.setEl.bind(this) + } componentDidMount() { this.highlightCode(); } @@ -18,7 +22,7 @@ class Highlight extends React.Component { } } - setEl = (el) => { + setEl(el) { this.el = el; };