I use tomcat as a backend server. The port is 8080. I don"t want to modify this. I want to modify the port of webpack Server.
I checked a lot on the Internet, all saying
devServer{
host:....,
port:....
}
but I tried but failed? Webpack is a novice. Boss, please give me some advice
the code is as follows:
var webpack=require("webpack");
const path=require("path");
//const htmlWebpackPlugin=require("html-webpack-plugin");
//const urlLoader=require("url-loader"); //base64
// path
module.exports = {
entry: "./src/main.js",
//common.js
devServer: {
host:"127.0.0.1",
open:true,
port:8090
},
output: {
path: path.resolve(__dirname,"dist"),
filename: "[name].bundle.js",
},
//
devServer:{
// webpack-dev-server
},
module: {
rules: [
//webpack 2.0 3.0 loaders
//webpack 4.0 rules
{
test: /\.css$/,
use:[
"style-loader",
"css-loader",
"less-loader",
"postcss-loader"
]
},{
test: require.resolve("jquery"),
use: [{
loader: "expose-loader",
options: "jQuery"
},{
loader: "expose-loader",
options: "$"
}]
}, {
test: /\.js$/,
loader: "babel-loader",
exclude: /node_modules/
},{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use:[
{
loader:"url-loader",
options:{
limit:1000,
name:"/static/images/assets/[hash:8].[name].[ext]"
}
}
]
}
// {test: /\.css$/, loader: "style-loader!css-loader",modules:true},
// {test:/\.png$/,loader:"url-loader?limit=10000"}
]
},
mode: "development",
};