var htmlWebpackPlugin=require('html-webpack-plugin');
var webpack=require('webpack');
var path=require('path');
module.exports={
context:__dirname,
entry:'./src/app.js',
output:{
path:path.resolve(__dirname,'./dist'),
filename:'js/[name].bundle.js'
},
module:{
rules:[
{
test:/\.js$/,
loader:'babel-loader',
exclude:path.resolve(__dirname,'/node_modules/'),
include:path.resolve(__dirname,'/src/'),
query:{
presets:['latest']
}
},
{
test:/\.css$/,
use:[
{
loader:'style-loader'
},
{
loader:'css-loader',
options:{
importLoaders:1
}
},
{
loader:'postcss-loader'
}
]
}
]
},
plugins:[
new htmlWebpackPlugin({
filename:'index.html',
template:'index.html',
inject:'body'
}),
new webpack.LoaderOptionsPlugin({
options:{
postcss:function(){
return [
require('autoprefixer')({
broswers:['last 5 versions']
})
]
}
}
})
]
};