webpack-serve
:https://github.com/webpack-contrib/webpack-serve
webpack-dev-server
:https://github.com/webpack/webpack-dev-server
他们都说他们是webpack的开发服务器。他们有什么不同?
答案 0 :(得分:19)
+-----------------+--------------------------+----------------------+
| | webpack-dev-server | webpack-serve |
+-----------------+--------------------------+----------------------+
| Initial release | 23 Dec 2014 | 12 feb 2018 |
| Total releases | 74 | 7 |
| Github stars | 3449 | 231 |
| Lines of code | 28301 | 16075 |
| under the hood | Express.js (22047 lines) | Koa.js (8913 lines)| |
| API | not aligned | API first |
| Mode | only maintenance | evolution |
| Total | work slower but supports | fast alternative |
| | old browsers | |
+-----------------+--------------------------+----------------------+
同时强>:
webpack-dev-server
模式中的package com.algorithm.software.catcher;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.os.AsyncTask;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.net.ResponseCache;
import java.util.HashMap;
public class login_screen extends AppCompatActivity {
EditText Email, Password;
Button LogIn ;
String PasswordHolder, EmailHolder;
String finalResult ;
String HttpURL = "https://localhost/user_login.php";
Boolean CheckEditText ;
HashMap<String,String> hashMap = new HashMap<>();
HttpParse httpParse = new HttpParse();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Email = (EditText)findViewById(R.id.p_e);
Password = (EditText)findViewById(R.id.pass);
LogIn = (Button)findViewById(R.id.log);
LogIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CheckEditTextIsEmptyOrNot();
if(CheckEditText){
UserLoginFunction(EmailHolder, PasswordHolder);
}
else {
Toast.makeText(login_screen.this, "Please fill all form fields.", Toast.LENGTH_LONG).show();
}
}
});
}
public void CheckEditTextIsEmptyOrNot(){
EmailHolder = Email.getText().toString();
PasswordHolder = Password.getText().toString();
if(TextUtils.isEmpty(EmailHolder) || TextUtils.isEmpty(PasswordHolder))
{
CheckEditText = false;
}
else {
CheckEditText = true ;
}
}
public void UserLoginFunction(final String email, final String password){
class UserLoginClass extends AsyncTask<String,Void,String> {
@Override
protected void onPostExecute(String httpResponseMsg) {
super.onPostExecute(httpResponseMsg);
if(httpResponseMsg.equalsIgnoreCase("Data Matched")){
finish();
Intent intent = new Intent(login_screen.this, WELCOME.class);
startActivity(intent);
}
else{
Toast.makeText(login_screen.this,httpResponseMsg,Toast.LENGTH_LONG).show();
}
}
@Override
protected String doInBackground(String... params) {
hashMap.put("email",params[0]);
hashMap.put("password",params[1]);
finalResult = httpParse.postRequest(hashMap, HttpURL);
return finalResult;
}
}
UserLoginClass userLoginClass = new UserLoginClass();
userLoginClass.execute(email,password);
}
}
( maintenance )<强>来源强>
答案 1 :(得分:1)
我没有使用过webpack-serve,但是通过查看文档,首先考虑的是它是相对较新的repo(7发布againest webpack-dev-server 70+)并且重点是使用浏览器本机WebSocket来获取资产而不是投票机制。我的猜测是,显然可以使webpack-serve在开发模式下比webpack-dev-server工作更好,更快。
这让人很好奇。我会尝试一下目前的设置,并尝试回顾一下结果。