vue--es6转es5打包
Vue–Es6转Es5核心部署:babel-loader部署过程:首先是加载Es5npm install --save-dev babel-loader@7 babel-core babel-preset-es2015然后是配置webpack.config.jsconst path = require('path');module.exports = {entry: '...
·
Vue–Es6转Es5
核心部署:babel-loader
部署过程:
首先是加载Es5
npm install --save-dev babel-loader@7 babel-core babel-preset-es2015
然后是配置webpack.config.js
const path = require('path');
module.exports = {
entry: './src/main.js',
output:{
path: path.resolve(__dirname,'dist'),
filename: 'bundle.js',
publicPath: 'dist/'
},
module: {
rules: [
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
},
{
test: /\.(png|jpg|gif)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 500
}
}
]
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2015']
}
}
},
{
test: /\.less$/,
use: [{
loader: "style-loader" // creates style nodes from JS strings
}, {
loader: "css-loader" // translates CSS into CommonJS
}, {
loader: "less-loader" // compiles Less to CSS
}]
}
]
}
}
更多推荐
已为社区贡献3条内容
所有评论(0)