简体   繁体   English

Webpack Output 根路径 ('/') Output 在文件系统中的位置在哪里?

[英]Where Does a Webpack Output Path of Root ('/') Output To In The Filesystem?

I'm looking at an existing webpack react project and the output path is set to '/'.我正在查看现有的 webpack 反应项目,并且 output 路径设置为“/”。 My understanding is that output path is an absolute path so that is setting the output for the build to the root dir - whatever that is on a Windows machine.我的理解是 output 路径是绝对路径,因此将 output 设置为构建到根目录 - 无论 Windows 机器上的内容。 I have no idea how this is working or where it is putting the build (I've tried searching with no luck)?我不知道这是如何工作的或将构建放在哪里(我尝试过没有运气的搜索)? Does anyone know?有人知道吗? Maybe there is a dependency library we're using that makes this behave differently to my expectations?也许我们正在使用一个依赖库,这使得它的行为与我的期望不同? Does setting the context make this change - I thought it only affected entry settings, We are using.设置上下文是否会进行此更改-我认为它仅影响我们正在使用的条目设置。 among other things webpack-dev-server and yarn workspaces除其他外,webpack-dev-server 和 yarn 工作区

Thanks in advance提前致谢

I think it is because we are using webpack-dev-server.我认为这是因为我们使用的是 webpack-dev-server。

From this page: https://webpack.js.org/guides/development/从这个页面: https://webpack.js.org/guides/development/

The following answer:以下答案:

webpack-dev-server doesn't write any output files after compiling. webpack-dev-server 编译后不会写入任何 output 文件。 Instead, it keeps bundle files in memory and serves them as if they were real files mounted at the server's root path.相反,它将捆绑文件保存在 memory 中,并像安装在服务器根路径上的真实文件一样提供它们。 If your page expects to find the bundle files on a different path, you can change this with the devMiddleware.publicPath option in the dev server's configuration.如果您的页面希望在不同的路径上找到捆绑文件,您可以使用开发服务器配置中的 devMiddleware.publicPath 选项进行更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM