Skip to content

Commit 6819609

Browse files
Merge pull request #215 from remarkablemark/examples/webpack
chore(examples): add webpack example
2 parents ecffbf1 + 2a9afbf commit 6819609

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

examples/webpack/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<style>
2+
body {
3+
font-family: 'Lucida Grande';
4+
}
5+
</style>
6+
<div id="root"></div>
7+
<script src="dist/main.js"></script>

examples/webpack/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"scripts": {
3+
"start": "npm run clean && npm run build && open index.html",
4+
"build": "webpack --mode=development --no-devtool",
5+
"clean": "rm -rf dist"
6+
},
7+
"devDependencies": {
8+
"html-react-parser": "../../",
9+
"react": "^17.0.1",
10+
"react-dom": "^17.0.1",
11+
"webpack": "^5.18.0",
12+
"webpack-cli": "^4.4.0"
13+
}
14+
}

examples/webpack/src/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import parse from 'html-react-parser';
2+
3+
import('react-dom').then(function (ReactDOM) {
4+
ReactDOM.render(
5+
parse('<h1>HTMLReactParser loaded with webpack</h1>'),
6+
document.getElementById('root')
7+
);
8+
});

0 commit comments

Comments
 (0)