On Github raingxm / webpack-session
Created by zhangxu
var b = require('./b.js');
console.log(b);
b.js
module.exports = 42;
bundle.js can now executed in browser
$ webpack entry output
$ webpack ./a.js bundle.js
$ webpack --config "path to config file"
moudle.exports = {
entry: path.resove(__dirname, "./a.js"),
output: {
path: __dirname,
filename: "bundle.js"
}
};
default config file webpack.config.js
var moudleA = require("./a.js");
module.exports = 42;
define(["./a.js"] , function (moduleA) {
return 42;
});
import someModule from "./someModule.js";
export default 42;
websites are not just javascript
<div class="hello-world">
<h1>Hello World</h1>
</div>
transform to
module.exports = "<div class="\"hello-world\"">\n
<h1>Hello world</h1>\n</div>";
$ npm install css-loader style-loader --save
require("style!css!./style.css");
module.exports = {
module: {
loaders: [
{ test: /\.css$/, loader: "!style!css" }
]
}
};
Demo3
$ https://github.com/raingxm/webpack-demo3.git
$ npm install
Demo4
$ https://github.com/Workfront/webpack-start.git
Demo5
$ https://github.com/Workfront/webpack-time-logger.git
Demo6
$ https://github.com/jesseskinner/react-webpack-demo.git