Selaa lähdekoodia

hello, es6 & webpack

the tooling is surprisingly good, although it took a bit to get started.
Lucas Stadler 11 vuotta sitten
vanhempi
commit
ee9e35002c

+ 2 - 0
js/react/.gitignore

@ -0,0 +1,2 @@
1
node_modules
2
bundle.js

+ 1 - 0
js/react/content.js

@ -0,0 +1 @@
1
module.exports = "It works from content.js.";

+ 9 - 0
js/react/entry.js

@ -0,0 +1,9 @@
1
require('./style.css');
2
3
class Greeter {
4
	greet(name = "World", suffix = "!") {
5
		console.log(`Hello, ${name}${suffix}`);
6
	}
7
}
8
9
new Greeter().greet("Alice");

+ 8 - 0
js/react/index.html

@ -0,0 +1,8 @@
1
<html>
2
    <head>
3
        <meta charset="utf-8">
4
    </head>
5
    <body>
6
        <script type="text/javascript" src="bundle.js" charset="utf-8"></script>
7
    </body>
8
</html>

+ 23 - 0
js/react/package.json

@ -0,0 +1,23 @@
1
{
2
  "name": "hello-react",
3
  "version": "0.0.1",
4
  "description": "Trying out react and related tooling.",
5
  "dependencies": {
6
    "6to5-core": "^3.5.3",
7
    "6to5-loader": "^3.0.0",
8
    "css-loader": "^0.9.1",
9
    "style-loader": "^0.8.3",
10
    "webpack": "^1.5.3"
11
  },
12
  "devDependencies": {},
13
  "scripts": {
14
    "test": "echo \"Error: no test specified\" && exit 1"
15
  },
16
  "repository": {
17
    "type": "git",
18
    "url": "https://github.com/heyLu/lp"
19
  },
20
  "author": "Lucas Stadler",
21
  "license": "MIT",
22
  "homepage": "https://github.com/heyLu/lp"
23
}

+ 3 - 0
js/react/style.css

@ -0,0 +1,3 @@
1
body {
2
	background-color: pink;
3
}

+ 13 - 0
js/react/webpack.config.js

@ -0,0 +1,13 @@
1
module.exports = {
2
	entry: "./entry.js",
3
	output: {
4
		path: __dirname,
5
		filename: "bundle.js"
6
	},
7
	module: {
8
		loaders: [
9
			{ test: /\.css$/, loader: "style!css" },
10
			{ test: /\.js$/, loader: "6to5-loader" }
11
		]
12
	}
13
};