码迷,mamicode.com
首页 > Web开发 > 详细

React with webpack

时间:2015-08-06 10:43:44      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:

 

 

//entry.js

require("!style!css!./style.css");
require("./hello.jsx");

// document.write("It works.");
document.write(require("./content.js"));

 

 

 

//hello.jsx
var React = require(‘react‘);


 var e = document.createElement(‘div‘); 
     e.id=‘example‘;
    document.body.appendChild(e); 

React.render(
  <h1>Hello, world!</h1>,
  document.getElementById(‘example‘)
);

 

 

module.exports = {
    entry: "./entry.js",
    output: {
        path: __dirname,
        filename: "bundle.js"
    },
    module: {
        loaders: [
            { test: /\.css$/, loader: "style!css" },
            { test: /\.jsx$/, loader: "jsx-loader" }
        ]
    }
};

 

 

http://jslog.com/2014/10/02/react-with-webpack-part-1/

 

http://gaearon.github.io/react-hot-loader/getstarted/

 

React with webpack

标签:

原文地址:http://www.cnblogs.com/zyip/p/4707141.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!