有誰知道如何停止webpack-dev-server?我曾嘗試使用按Ctrl +ç和按Ctrl +ž,這是不行的,不管我按它一次或兩次。另外,即使我關閉了命令行界面,它仍然有效。即使我更改了服務器端口,以前的服務器端口仍然有效。所以當我關閉CLI或想更改webpack.config.js中的一些參數時,我必須每次更改服務器端口。如何停止webpack-dev-server
這裏是我的webpack.config.js:
const path = require('path');
const HtmlWebpackPlugin = require("html-webpack-plugin");
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
\t entry: {
\t \t main: './src/main.js'
\t },
\t output: {
\t \t path: path.resolve(__dirname, 'dist'),
\t \t filename: 'bundle.js',
\t },
\t devtool: false,
\t module: {
\t \t rules: [{
\t \t \t test: /\.css$/,
\t \t \t use: ExtractTextPlugin.extract({
\t \t \t \t fallback: "style-loader",
\t \t \t \t use: "css-loader"
\t \t })},{
\t \t \t test: /\.(js|jsx)?$/,
\t \t \t use: ['babel-loader'],
\t \t \t exclude: /node_modules/
\t \t }]
\t },
\t devServer: {
\t \t contentBase: './dist',
\t \t hot: true,
\t \t port: 8088,
\t },
\t plugins: [
\t \t new HtmlWebpackPlugin({
\t \t \t title: "Hello React",
\t \t \t template: "template.html",
\t \t }),
\t \t new webpack.HotModuleReplacementPlugin(),
\t \t new ExtractTextPlugin("style.bundle.css")
\t ]
};
,這裏是我的package.json
{
"name": "react-test",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --config webpack.config.js",
"start": "webpack-dev-server --config webpack.config.js",
"produce": "webpack -p --config webpack.config.js"
},
"author": "dongxu <[email protected]>",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"css-loader": "^0.28.4",
"html-webpack-plugin": "^2.29.0",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-hot-loader": "^1.3.1",
"style-loader": "^0.18.2",
"webpack": "^3.4.1",
"webpack-dev-server": "^2.6.1"
}
}
Addtionally,有我的騙局唯一的窗口: enter image description here
正如你看到的,我已按按Ctrl + Ç兩次,後來,我改變文件的內容,在的WebPack-DEV-服務器重新編譯,我仍然可以看到的內容刷新我的瀏覽器。
我已經使用Ctrl + C在每次登錄的平臺上停止它。必須有其他事情發生 – rossipedia
當您嘗試使用Ctrl + C時,您可以發佈控制檯的屏幕截圖嗎? – FuriousD
按'Q'有幫助嗎? –