为什么我不应该在生产中使用webpack-dev-server? [英] Why should I not use webpack-dev-server in production?

查看:125
本文介绍了为什么我不应该在生产中使用webpack-dev-server?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过AWS ec2-instance部署了使用webpack-dev-server构建的应用程序.它说我应该将其更改为生产.在开发和生产中进行部署有什么区别?如果开发服务器也将每个资产和组件都打包在一起,那么使用生产的好处是什么?

I have deployed my app which is built with webpack-dev-server through AWS ec2-instance. It says I should change it to production. What is the difference between deploying in development and production? If the development server compiles every assets and components into a bundle too, what is the benefit of using production?

其他问题:设置启动脚本以启动webpack-dev-server时,我看到有人将其编写为

Additional question: When setting a start script to start webpack-dev-server, I saw people writing it as

  "scripts": {
      "start": "webpack-dev-server --entry ./src/js/app.js --output-filename ./dist/bundle.js"
  }

从中为何将--output前缀添加到-filename的原因是什么?我尝试在没有它的情况下编写,显然它可以正常工作.我查阅了文档,但找不到所需的内容.有人可以告诉我那是什么吗?谢谢.

from it, what is the reason for prepending --output to -filename? I tried writing without it and apparently it works fine. I looked up the documentation, but couldn't find what I was looking for. could someone tell me what that is if one knows? Thank you.

推荐答案

优化和安全性是最大的因素.

Optimizations and security are the biggest factors.

这篇关于为什么我不应该在生产中使用webpack-dev-server?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆