与 package.json 配合使用
var path=require("path");
var OpenBrowserPlugin = require('open-browser-webpack-plugin');
module.exports={
entry:"./index.js",
output:{
path:path.resolve(__dirname,__dirname),
filename:"blund.js"
},
module:{
loaders:[
{
test:/.css$/,
loader:"style-loader!css-loader"
},
{
test: /.json$/,
loader: 'json-loader'
},
{
test: /.(png|jpg|gif)$/i,
loader: 'url-loader',
options: {
limit: 8192
}
},
{
test: /.m?js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
]
},
plugins:[
new OpenBrowserPlugin({ url: 'http://localhost:8080' })
],
devServer:{
port:8080
}
};