Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

##Notes ###Link

###First Demo

  • use atom as the editor for auto-complete functionality

  • init package.json

npm init
  • install webpack
sudo npm i webpack --save-dev
  • create index.js, and use npm start generate bundle.js a single file include in index.html

  • check with our brower, execute bundle.js, rendering the html

google-chrome-stable ./index.html

###Second Demo

  • create bear.js

  • modify index.js to require the module bear.js

  • check with our brower, execute bundle.js, rendering the html

google-chrome-stable ./index.html

###Third Demo(Server Mode)

  • install webpack other dependencies
sudo npm i webpack-dev-server --save-dev
  • browse http://localhost:8080/webpack-dev-server/

  • install jquery

sudo npm i jquery --save
  • async loading index.js
require(['./bear.js'], function(bear) {
  document.body.appendChild(bear[0]);
})
  • install css loader
sudo npm i css-loader --save-dev
  • install style loader
sudo npm i style-loader --save-dev
  • modify bear.js, ask the css loader to parse css first
require('css!./bear.css')