gpt4 book ai didi

Webpack 开发服务器配置 - contentBase 在最新版本中不起作用

转载 作者:行者123 更新时间:2023-12-04 11:58:35 26 4
gpt4 key购买 nike

当我将 webpack 升级到 4.0.0-beta.3 并运行 npx webpack serve我收到此错误:

[webpack-cli] Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
- configuration has an unknown property 'contentBase'. These properties are valid:
object { bonjour?, client?, compress?, devMiddleware?, firewall?, headers?, historyApiFallback?, host?, hot?, http2?, https?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, public?, setupExitSignals?, static?, transportMode?, watchFiles? }
这是我在 3.11.2 中工作的 webpack.config.js:
const path = require('path');
const ArcGISPlugin = require("@arcgis/webpack-plugin");

module.exports = {
mode: 'development',
entry: {
main: './app/main.js'
},
plugins: [
new ArcGISPlugin()
],
devServer: {
contentBase: './'
}
}
我来自 package.json 的 devDependencies:
  "devDependencies": {
"@arcgis/webpack-plugin": "^4.18.0",
"dojo-typings": "^1.11.11",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^4.0.0-beta.3"
我需要如何更新我的配置才能使最新版本正常工作?当我取出开发服务器对象时,服务器将运行,但提供不存在的 ./public 之外的内容。
我是 webpack 的新手,所以我还不熟悉应用程序、配置和要求。

最佳答案

  devServer: {
static: './'
}
我应该更仔细地阅读错误。上面的对象使我的配置再次工作。

关于Webpack 开发服务器配置 - contentBase 在最新版本中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67926476/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com