summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <yuval@y3xz.com>2016-06-21 21:54:42 +0300
committerYuval Adam <yuval@y3xz.com>2016-06-21 21:54:42 +0300
commit448696e920cc06f18a023dc2ebf304690f711edd (patch)
tree8f492fc2fc58d3fd5e856cb652d9caeba8e034b0
parentbebde1a43d5604104beed17d81bfcbf446d37880 (diff)
Working version
-rw-r--r--.babelrc3
-rw-r--r--index.html1
-rw-r--r--index.js5
-rw-r--r--package.json6
-rw-r--r--webpack.config.js7
5 files changed, 18 insertions, 4 deletions
diff --git a/.babelrc b/.babelrc
new file mode 100644
index 0000000..86c445f
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,3 @@
+{
+ "presets": ["es2015", "react"]
+}
diff --git a/index.html b/index.html
index 6511e4f..a90271c 100644
--- a/index.html
+++ b/index.html
@@ -3,6 +3,7 @@
<meta charset="utf-8">
</head>
<body>
+ <div id="root"></div>
<script type="text/javascript" src="bundle.js" charset="utf-8"></script>
</body>
</html>
diff --git a/index.js b/index.js
index 702f19a..73d47e6 100644
--- a/index.js
+++ b/index.js
@@ -1 +1,4 @@
-document.write("It works.");
+import React from 'react'
+import ReactDOM from 'react-dom'
+
+ReactDOM.render(<h1>Hello World</h1>, document.getElementById('root'))
diff --git a/package.json b/package.json
index 9390ae8..1fc7597 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,13 @@
"main": "index.js",
"dependencies": {},
"devDependencies": {
+ "babel-core": "^6.10.4",
+ "babel-loader": "^6.2.4",
+ "babel-preset-es2015": "^6.9.0",
+ "babel-preset-react": "^6.5.0",
"css-loader": "^0.23.1",
+ "react": "^15.1.0",
+ "react-dom": "^15.1.0",
"style-loader": "^0.13.1",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
diff --git a/webpack.config.js b/webpack.config.js
index feca40a..5d1e488 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,12 +1,13 @@
module.exports = {
- entry: "./index.js",
+ entry: './index.js',
output: {
path: __dirname,
- filename: "bundle.js"
+ filename: 'bundle.js'
},
module: {
loaders: [
- { test: /\.css$/, loader: "style!css" }
+ { test: /\.js$/, loader: 'babel', },
+ { test: /\.css$/, loader: 'style!css' }
]
}
};