本文共 989 字,大约阅读时间需要 3 分钟。
mkdir webpackapp
cnpm init
dir
more package.json
cnpm install webpack --save-dev
mkdir appdirmkdir publicdir
cd appecho ... > Greeter.jsdirecho ... > main.jsdircd ..cd publicecho ... > index.htmldir
Webpack Sample Project
var greeter = require('./Greeter.js');document.getElementById('root').appendChild(greeter());
module.exports = function() { var greet = document.createElement('div'); greet.textContent = "Hi there and greetings!"; return greet;};
webpack app/Greeter.js public/bundle.js
cd publicdirmore bundle.js
本文转自 素颜猪 51CTO博客,原文链接:http://blog.51cto.com/suyanzhu/1899038
转载地址:http://jlsfa.baihongyu.com/