Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Webpack 没有Web包开发服务器的生成文件_Webpack_Webpack Dev Server - Fatal编程技术网

Webpack 没有Web包开发服务器的生成文件

Webpack 没有Web包开发服务器的生成文件,webpack,webpack-dev-server,Webpack,Webpack Dev Server,webpack.config.js 我运行此npm命令: "start": "webpack-dev-server --port 9898 --devtool eval --progress --colors --content-base gae/src --hot --inline", 它构建得很好: > besetfree@1.0.0 start /Users/me/code/besetfree > webpack-dev-server --port 9898 --devtoo

webpack.config.js

我运行此npm命令:

"start": "webpack-dev-server --port 9898 --devtool eval --progress --colors --content-base gae/src --hot --inline",
它构建得很好:

> besetfree@1.0.0 start /Users/me/code/besetfree
> webpack-dev-server --port 9898 --devtool eval --progress --colors --content-base gae/src --hot --inline

 70% 1/1 build moduleshttp://localhost:9898/
webpack result is served from /
content is served from /Users/me/code/besetfree/gae/src
Hash: 1abe8a20ea579ccbfa3a
Version: webpack 1.12.12
Time: 4361ms
       Asset     Size  Chunks             Chunk Names
besetfree.js  1.51 MB       0  [emitted]  main
chunk    {0} besetfree.js (main) 1.31 MB [rendered]
但在以下位置没有文件:

有什么帮助吗?

您需要在您的网页配置中添加一个,以便让服务器知道从哪个URL提供服务

output: {
    path: path.resolve(__dirname, 'gae/src/static/build'),
    publicPath: "static/build",
    filename: 'besetfree.js'
},

似乎我需要将其设置为
publicPath:'http://localhost:9898/static/build“,
并在服务器前面加上
“dev”:“npm运行生成和…
。这似乎是可行的,但我不确定为什么必须有一个物理文件才能让它最初工作。我认为publicPath是用于构建资产的链接的?我不认为这是正确的答案,因为我以前从未用webpack这样做过,但我也没有用webpack dev server获得构建输出。
output: {
    path: path.resolve(__dirname, 'gae/src/static/build'),
    publicPath: "static/build",
    filename: 'besetfree.js'
},