diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..e623fa5 --- /dev/null +++ b/.npmignore @@ -0,0 +1 @@ +.travis.yml \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..37e7528 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: node_js +node_js: +- '6' +- '5.11' +deploy: + provider: npm + email: ohwubang@gmail.com + api_key: + secure: h1e3FKHd6/60wqOVAkiGVqSj1NUtw5si+4yEkAC31ewDJS5dEMmLueBg+joYd31FR2dEzUgJpgQ9D1jg4tsuuA771ZaWuYqapoLW9mbyNcEpYMsbMb6EMOdUI5fVhaJisXtPThkYxYMhcyocXHKXaDs0FHdBt+ICmGLuDi0yhhIe3GSac4sW/tS4luvTfx1vW+4awGJkw6SEeAQYADAFDfPSOdDZXGKbI/ugUHAkqF252pwmTvRVICrK0CK0VxMZzumLMEdMChCpBfDvKkHYzXDDm7HB9zXJcfmZySNdtgTETkzSsRoXV7IW6bcYnx6sZS2JNSEF1jHzIhaDBgLj6z4dXV1HA8dQPzLNFEwshewZX3cG5dtRc+QgJYJX1liv8teDBVwnczcYsbL9nYGj3eTCrDaoOaSdsyc2lY4XXbe7aGsJL0z3xyDDiQnoLCW3X51RvgFH50NW5XGJ/fjnafF5uEqHxIwbTCojU9anZVcWYfhwZkfOhBOh6nDArQzXUjiqwNMAhF3JcAs9YQSjW2jGB+kFCSJlazCyL4+SC3E3fxvMNUJDBO67uCjgUsoZpeOwC3kLOo35hnFZk3jLWRGnQewf+vu4dbJF6W/pyIuTxf/sUF+hdTo8OLGcqpPfLM2Q/mOXpU6rKBKUPu7r0Gqi6YGQC35JQr0C73fBTzs= + on: + tags: true + repo: bangwu/react-to-html-webpack-plugin diff --git a/CHANGELOG.md b/CHANGELOG.md index 46aeda1..1ab0ee5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## [Unreleased][unreleased] -### Changed -- Nothing yet. +## [2.2.1] - 2016-11-21 +### Added +- Let the package to support React 15 ## [2.2.0] - 2015-07-22 ### Added @@ -28,8 +28,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - Basic support for rendering factories without props to HTML. -[unreleased]: https://github.com/markdalgleish/react-to-html-webpack-plugin/compare/v2.2.0...HEAD -[2.2.0]: https://github.com/markdalgleish/react-to-html-webpack-plugin/compare/v2.1.0...v2.2.0 -[2.1.0]: https://github.com/markdalgleish/react-to-html-webpack-plugin/compare/v2.0.1...v2.1.0 -[2.0.1]: https://github.com/markdalgleish/react-to-html-webpack-plugin/compare/v2.0.0...v2.0.1 -[2.0.0]: https://github.com/markdalgleish/react-to-html-webpack-plugin/compare/v1.0.0...v2.0.0 +[2.2.1]: https://github.com/bangwu/react-to-html-webpack-plugin/compare/v2.2.0...V2.2.1 +[2.2.0]: https://github.com/bangwu/react-to-html-webpack-plugin/compare/v2.1.0...v2.2.0 +[2.1.0]: https://github.com/bangwu/react-to-html-webpack-plugin/compare/v2.0.1...v2.1.0 +[2.0.1]: https://github.com/bangwu/react-to-html-webpack-plugin/compare/v2.0.0...v2.0.1 +[2.0.0]: https://github.com/bangwu/react-to-html-webpack-plugin/compare/v1.0.0...v2.0.0 diff --git a/README.md b/README.md index b550bcc..b6f7bc6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -[![npm](https://img.shields.io/npm/v/react-to-html-webpack-plugin.svg?style=flat-square)](https://npmjs.org/package/react-to-html-webpack-plugin) [![Dependency Status](https://img.shields.io/david/markdalgleish/react-to-html-webpack-plugin.svg?style=flat-square)](https://david-dm.org/markdalgleish/react-to-html-webpack-plugin) +[![npm version](https://badge.fury.io/js/webpack-plugin-react-to-html.svg)](https://badge.fury.io/js/) +[![npm version](https://badge.fury.io/js/polyfills-webpack-plugin.svg)](https://badge.fury.io/js/polyfills-webpack-plugin) # React-to-HTML Webpack Plugin @@ -11,7 +12,7 @@ Components are rendered after all source files have been compiled, so JSX works ## Install ```bash -$ npm install --save-dev react-to-html-webpack-plugin +$ npm install --save-dev webpack-plugin-react-to-html ``` ## Basic Usage @@ -21,7 +22,7 @@ This basic example assumes that the React component renders `` as the root ### webpack.config.js ```js -var ReactToHtmlPlugin = require('react-to-html-webpack-plugin'); +var ReactToHtmlPlugin = require('webpack-plugin-react-to-html'); module.exports = { @@ -70,7 +71,7 @@ module.exports = MyComponent; ### webpack.config.js ```js -var ReactToHtmlPlugin = require('react-to-html-webpack-plugin'); +var ReactToHtmlPlugin = require('webpack-plugin-react-to-html'); module.exports = { diff --git a/index.js b/index.js index 664c11a..3fed520 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,5 @@ var React = require('react'); +var ReactDOMServer = require('react-dom/server'); var evaluate = require('eval'); // src can be either a filename or a chunk name @@ -15,6 +16,7 @@ ReactToHtmlWebpackPlugin.prototype.apply = function(compiler) { try { var asset = findAsset(this.src, compiler, webpackStatsJson); + if (!asset) { throw new Error('Output file not found: "' + this.src + '"'); } @@ -22,7 +24,7 @@ ReactToHtmlWebpackPlugin.prototype.apply = function(compiler) { var source = asset.source(); var Component = evaluate(source, /* filename: */ undefined, /* scope: */ undefined, /* includeGlobals: */ true); var renderMethod = this.options.static ? 'renderToStaticMarkup' : 'renderToString'; - var html = React[renderMethod](React.createElement(Component)); + var html = ReactDOMServer[renderMethod](React.createElement(Component)); var template = this.options.template; diff --git a/package.json b/package.json index e772cb4..19a09cf 100644 --- a/package.json +++ b/package.json @@ -1,27 +1,28 @@ { - "name": "react-to-html-webpack-plugin", - "version": "2.2.0", + "name": "webpack-plugin-react-to-html", + "version": "2.2.2", "description": "Webpack plugin that renders React components to HTML files", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\"" }, "repository": { "type": "git", - "url": "git@github.com:markdalgleish/react-to-html-webpack-plugin.git" + "url": "git@github.com:bangwu/react-to-html-webpack-plugin.git" }, "author": { "name": "Mark Dalgleish" }, "license": "MIT", "bugs": { - "url": "https://github.com/markdalgleish/react-to-html-webpack-plugin/issues" + "url": "https://github.com/bangwu/react-to-html-webpack-plugin/issues" }, - "homepage": "https://github.com/markdalgleish/react-to-html-webpack-plugin", + "homepage": "https://github.com/bangwu/react-to-html-webpack-plugin", "dependencies": { "eval": "^0.1.0" }, "peerDependencies": { - "react": "0.12.x || >=0.13.0-beta.1" + "react": "^15.1.0", + "react-dom": "^15.1.0" } }