webpack 开发服务器没有 运行 piz 帮助我
webpack dev server doesn't run piz help me
我的 webpack dev sercer 没有 运行 piz 帮助我的
我的错误:
enter image description here
webpack 配置
devtool: 'inline-source-map',
devServer: {
contentBase: path.resolve(__dirname, './dist/app.js'),
compress: true,
port: 3000,
open: true,
hot: true,
watchContentBase: true
}
package.json :
"scripts": {
"build": "webpack",
"dev": "webpack serve"
},
"devDependencies": {
"alpinejs": "^3.4.2",
"css-loader": "^6.5.0",
"html-webpack-plugin": "^5.5.0",
"style-loader": "^3.3.1",
"webpack": "^5.60.0",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.4.0"
}
webpack 版本 5 不再支持此配置
试试这个
{
devtool: 'inline-source-map',
devServer: {
static: {
directory: path.resolve(__dirname, './dist/app.js')
},
compress: true,
port: 3000,
open: true,
hot: true,
watch: true
}
}
更多详情请查看dev-server documentation
我的 webpack dev sercer 没有 运行 piz 帮助我的
我的错误:
enter image description here
webpack 配置
devtool: 'inline-source-map',
devServer: {
contentBase: path.resolve(__dirname, './dist/app.js'),
compress: true,
port: 3000,
open: true,
hot: true,
watchContentBase: true
}
package.json :
"scripts": {
"build": "webpack",
"dev": "webpack serve"
},
"devDependencies": {
"alpinejs": "^3.4.2",
"css-loader": "^6.5.0",
"html-webpack-plugin": "^5.5.0",
"style-loader": "^3.3.1",
"webpack": "^5.60.0",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.4.0"
}
webpack 版本 5 不再支持此配置
试试这个
{
devtool: 'inline-source-map',
devServer: {
static: {
directory: path.resolve(__dirname, './dist/app.js')
},
compress: true,
port: 3000,
open: true,
hot: true,
watch: true
}
}
更多详情请查看dev-server documentation