您好,登錄后才能下訂單哦!
cd webpack-test
cnpm init
cnpm install webpack --save-dev
dir
源文件目錄 mkdir src 靜態資源目錄 mkdir dist
腳本目錄 mkdir script 樣式目錄 mkdir style
cd dist mkdir js
cd .. cd src cd script echo ... > main.js main.js內容如下: function helloWorld(){ }
echo ... > index.html 文件名:index.html 內容如下: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title></title> <link rel="stylesheet" href=""> </head> <body> <script src="bundle.js"></script> </body> </html>
echo ... > webpack.config.js webpack.config.js內容如下: module.exports={ entry:'./src/script/main.js', output:{ path:'./dist/js', filename:'bundle.js' } }
cd dist/js dir
ren webpack.config.js webpack.dev.config.js dir
webpack
webpack --config webpack.dev.config.js
{ "name": "webpack-test", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "webpack":"webpack --config webpack.config.js --progress --display-modules --colors --display-reason" }, "author": "", "license": "ISC", "devDependencies": { "webpack": "^2.2.1" } }
cnpm run webpack
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。