Skip to content

support the React 15v #13

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.travis.yml
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 8 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -21,7 +22,7 @@ This basic example assumes that the React component renders `<html>` 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 = {

Expand Down Expand Up @@ -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 = {

Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,14 +16,15 @@ ReactToHtmlWebpackPlugin.prototype.apply = function(compiler) {

try {
var asset = findAsset(this.src, compiler, webpackStatsJson);

if (!asset) {
throw new Error('Output file not found: "' + this.src + '"');
}

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;

Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}