webpack應用
1) 安裝webpack webpack-cli
$ npm install webpack webpack-cli --save-devwebpack
2) 添加配置文件 webpack.config.js
const path = require('path');
module.exports = {
entry: './index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
}
}web
3) 修改package.json
"scripts":{
"build":"webpack"
}
4) 執行打包操做
npm run buildnpm
npm init
npm install xxx
npm uninstall xxx
npm config list
npm config get prefix
npm run xxxjson