在webpack的
getting started页面中,它提到了关于webpack-dev-server的部分 –
The dev server uses webpack’s watch mode. It also prevents webpack
from emitting the resulting files to disk. Instead it keeps and serves
the resulting files from memory.
这是否意味着捆绑的文件webpack-dev-server编译只保存在内存中,我还必须让webpack –watch在后台运行以及dev-server进程实际将编译后的文件保存到我的硬盘?
最佳答案 webpack-dev-server显然不会将您的代码编译到磁盘,而是将其保存在内存中.这意味着您需要手动编译更改,或者如果您希望更改反映在编译文件中,则在后台运行webpack –watch.我学到了
hard way.
在深入挖掘webpack-dev-server docs之后:
This modified bundle is served from memory at the relative path
specified in publicPath (see API). It will not be written to your
configured output directory. Where a bundle already exists at the same
URL path, the bundle in memory takes precedence (by default).