webpack最简单的打包命令 es6语法规范
sum.js
function sum(a,b){
return a+b
}
app.js
import sum from './sum.js'
console.log(sum(12,22))
打包命令
*webpack app.js bundle.js*
webpack打包支持common.js的规范
minus.js
module.exports function minus(a,b){
return a-b
}
app.js
var minus = require('./minus.js')
console.log(minus(22,10))
webpack app.js bundle.js
webpack 对AMD语法的支持
multi.js
define(function(require, factory){
return function(a,b){
return a*b
}
})
app.js
var multi=require(['./multi.js'])
console.log(multi(10,22))
webpack app.js bundle.js