Skip to content

Instantly share code, notes, and snippets.

@yosisa
Created April 5, 2015 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yosisa/db670ca840f1a2afce3c to your computer and use it in GitHub Desktop.
Save yosisa/db670ca840f1a2afce3c to your computer and use it in GitHub Desktop.
webpack で始めるイマドキのフロントエンド開発 ref: http://qiita.com/yosisa/items/61cfd3ede598e194813b
$ npm install webpack -g
$ cd /path/to/project
$ npm init
$ npm install webpack --save-dev
<div id="demo">
<div>{{message}}</div>
<input v-model="message">
</div>
<script type="text/javascript" src="bundle.js" charset="utf-8"></script>
$ webpack main.js bundle.js
Hash: 8bd5cc0129397bf5744f
Version: webpack 1.4.15
Time: 256ms
Asset Size Chunks Chunk Names
bundle.js 181297 0 [emitted] main
[0] ./main.js 109 {0} [built]
+ 62 hidden modules
module.exports = {
entry: './main.js',
output: {
path: __dirname,
filename: 'bundle.js'
}
};
$ webpack
Hash: 1e37faf49db800f67a24
Version: webpack 1.4.15
Time: 265ms
Asset Size Chunks Chunk Names
bundle.js 181297 0 [emitted] main
[0] ./main.js 109 {0} [built]
+ 62 hidden modules
document.write("Hello webpack");
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script type="text/javascript" src="bundle.js" charset="utf-8"></script>
</body>
</html>
$ webpack main.js bundle.js
Hash: c2f39b0a6cfb9cd0d808
Version: webpack 1.4.15
Time: 28ms
Asset Size Chunks Chunk Names
bundle.js 1529 0 [emitted] main
[0] ./main.js 33 {0} [built]
module.exports = function(msg) {
document.write("[print] " + msg);
};
var print = require("./print");
print("Hello webpack");
$ webpack main.js bundle.js
Hash: 16b1755528d260b71262
Version: webpack 1.4.15
Time: 29ms
Asset Size Chunks Chunk Names
bundle.js 1694 0 [emitted] main
[0] ./main.js 56 {0} [built]
[1] ./print.js 59 {0} [built]
npm install vue --save
var Vue = require('vue');
var demo = new Vue({
el: '#demo',
data: {
message: 'Hello Vue.js!'
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment