Skip to content

Commit 8ca104d

Browse files
Merge pull request #31 from remarkablemark/[email protected]
Fix webpack error by reverting to [email protected] for v0.2.0
2 parents b809226 + dfb86c2 commit 8ca104d

File tree

5 files changed

+27
-40
lines changed

5 files changed

+27
-40
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ Parser('<p>Hello, world!</p>');
3333
$ npm install html-react-parser
3434
```
3535

36+
Or if you're using react <15.4:
37+
38+
```sh
39+
$ npm install [email protected]
40+
```
41+
3642
[CDN](https://unpkg.com/html-react-parser/):
3743

3844
```html

lib/DOMPropertyConfig.js

-25
This file was deleted.

lib/attributes-to-props.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
/**
44
* Module dependencies.
55
*/
6-
var HTMLDOMPropertyConfig = require('./DOMPropertyConfig').HTMLDOMPropertyConfig;
76
var utilities = require('./utilities');
87
var propertyConfig = require('./property-config');
8+
var config = propertyConfig.config;
9+
var isCustomAttribute = propertyConfig.HTMLDOMPropertyConfig.isCustomAttribute;
910

1011
/**
1112
* Make attributes compatible with React props.
@@ -24,20 +25,20 @@ function attributesToProps(attributes) {
2425
propertyValue = attributes[propertyName];
2526

2627
// custom attributes (`data-` and `aria-`)
27-
if (HTMLDOMPropertyConfig.isCustomAttribute(propertyName)) {
28+
if (isCustomAttribute(propertyName)) {
2829
props[propertyName] = propertyValue;
2930
continue;
3031
}
3132

3233
// make HTML DOM attribute/property consistent with React attribute/property
33-
reactProperty = propertyConfig.html[propertyName.toLowerCase()];
34+
reactProperty = config.html[propertyName.toLowerCase()];
3435
if (reactProperty) {
3536
props[reactProperty] = propertyValue;
3637
continue;
3738
}
3839

3940
// make SVG DOM attribute/property consistent with React attribute/property
40-
reactProperty = propertyConfig.svg[propertyName];
41+
reactProperty = config.svg[propertyName];
4142
if (reactProperty) {
4243
props[reactProperty] = propertyValue;
4344
}

lib/property-config.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
* Module dependencies.
55
*/
66
var utilities = require('./utilities');
7-
var DOMPropertyConfig = require('./DOMPropertyConfig');
8-
var HTMLDOMPropertyConfig = DOMPropertyConfig.HTMLDOMPropertyConfig;
9-
var SVGDOMPropertyConfig = DOMPropertyConfig.SVGDOMPropertyConfig;
7+
8+
// HTML and SVG DOM Property Configs
9+
var HTMLDOMPropertyConfig = require('react/lib/HTMLDOMPropertyConfig');
10+
var SVGDOMPropertyConfig = require('react/lib/SVGDOMPropertyConfig');
1011

1112
var config = {
1213
html: {},
@@ -54,6 +55,10 @@ for (propertyName in SVGDOMPropertyConfig.Properties) {
5455
}
5556

5657
/**
57-
* Export React property config.
58+
* Export React property configs.
5859
*/
59-
module.exports = config;
60+
module.exports = {
61+
config: config,
62+
HTMLDOMPropertyConfig: HTMLDOMPropertyConfig,
63+
SVGDOMPropertyConfig: SVGDOMPropertyConfig
64+
};

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
"author": "Mark <[email protected]>",
66
"main": "index.js",
77
"scripts": {
8-
"build": "NODE_ENV=development webpack index.js dist/html-react-parser.js",
8+
"build-unmin": "NODE_ENV=development webpack index.js dist/html-react-parser.js",
99
"build-min": "NODE_ENV=production webpack -p index.js dist/html-react-parser.min.js",
10-
"prepublish": "npm run build && npm run build-min",
10+
"clean": "rm -rf dist",
11+
"prepublish": "npm run clean && npm run build-unmin && npm run build-min",
1112
"test": "mocha",
1213
"lint": "eslint index.js \"lib/**\" \"test/**\"",
1314
"cover": "istanbul cover _mocha -- -R spec \"test/**/*\"",
@@ -36,15 +37,14 @@
3637
"istanbul": "^0.4.5",
3738
"jsdomify": "^2.1.0",
3839
"mocha": "^3.0.2",
39-
"react": "*",
40-
"react-dom": "*",
40+
"react": "15.3",
41+
"react-dom": "15.3",
4142
"webpack": "^1.13.2"
4243
},
4344
"peerDependencies": {
44-
"react": ">=0.14"
45+
"react": "<=15.3"
4546
},
4647
"browser": {
47-
"./lib/html-to-dom-server.js": false,
4848
"htmlparser2/lib/Parser": false,
4949
"domhandler": false
5050
},

0 commit comments

Comments
 (0)