标签:static file try ble port entry output out npm
创建一个项目名:
全局安装webpack
cnpm install -g webpack-dev-server
1.cnpm init 初始化
2.cnpm i webpack webpack-dev-server -D
3.cnpm install babel-loader babel-core babel-preset-env -D
之后在项目下创建应有文件:
static文件夹下的index.html,
<div id="toor"></div>
src文件夹,
static静态文件夹,
dist输出文件夹,
webpack.config.js配置文件:
const HtmlWebpackPlugin = require(‘html-webpack-plugin‘);
module.export = {
entry:‘./src/main.js‘,
output:{
path:"_dirname+‘/dist‘",
filename:"js/app.js"
},
plugins:[
new HtmlWebpackPlugin({
templete:‘./static/index.html‘,
filename:‘index.html‘
})
],
module:{
loaders:[
{test:/\.js$/,loader:‘bable-loader‘,exclude:/node_module/}
]
}
}
创建.babelrc文件
{
"presets":[
"env"
]
}
标签:static file try ble port entry output out npm
原文地址:https://www.cnblogs.com/gujie-junlintianxia/p/9473819.html