run server的文件
运行后的title 请问为什么会有这样的问题
这是js文件 应该不会改动title
const path = require("path")
const webpack = require("webpack")
const uglify = require("uglifyjs-webpack-plugin")
const htmlPlugin = require("html-webpack-plugin")
module.exports = {
entry:{
entry:'./src/entry.js',//配置多入口文件
},//入口文件
output:{
path:path.resolve(__dirname,"dist"),//node语法 dist文件夹的绝对路径
filename:'[name].js'//[name]的意思是打包后的文件和打包前的文件名字一样
},//出口文件
module:{
rules:[
{
test:/\.css$/,//用正则表达式来处理处理名
use:[
{
loader:'style-loader'
},
{
loader:'css-loader'
}
],
},
{
test: /\.(png|jpg|gif)/,
use:[
{
loader:'url-loader',
options:{
limit:500000 //小于500000字节的自动转base64
}
}
]
}
]//规则
},//模块
plugins:[
//new uglify()
new htmlPlugin({
minify: {
removeAttributeQuotes:true
},
hash:true,
template:'./src/index.html'
})
],//插件
devServer:{
contentBase: path.resolve(__dirname, "dist"),//基本目录结构,监听的目录结构
host:'192.168.1.9',//本机ip地址
compress:true,//服务器压缩
port:1717
},//webpack开发服务
}
config.js的配置 就是一些热更新和压缩插件
看两张图,也看不出什么,瞎猜吧。
查看是否有JS文件对title做了改动,还有webpack.config.js里是否有什么 神奇的插件 也是对title做了改动的,例如是否使用了套用模板的插件。
按照普通的项目构建顺序,不会出现这种情况啊。
题目更新了,答案更新一波。
实在不行,你就在 new htmlPlugin里加一个这个字段