在react项目中,创建的bundle.js文件去哪了??

在练习webpack来打包项目的时候,配置文件是这样的

clipboard.png

结合express server.js文件是这样的:

clipboard.png

不没有报错,,只不过又有一点不太明白,,就是在webpack配置文件中写到文件出口是一个static文件夹下的bundle.js文件
然后index.html文件中也是引入了这个文件

clipboard.png

但是在npm run start后index.html正常显示,network中也显示加载了bundle.js文件,

clipboard.png

但是编辑其中却没有这个文件,

clipboard.png

请问大神,,这是为什么呢??

阅读 5.7k
1 个回答

因为你用了webpack-dev-middleware,且看文档如何说的:

  • No files are written to disk, it handle the files in memory

  • If files changed in watch mode, the middleware no longer serves the old bundle, but delays requests until the compiling has finished. You don't have to wait before refreshing the page after a file modification.

  • I may add some specific optimization in future releases.

第一条就说明了它不会生成物理文件到磁盘,而是直接从memory中响应请求的,这样更快嘛

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题