我正在配置简单的Webpack堆栈,并且它可以工作,但问题是每次文件更改时都会重新加载应用程序。有没有办法关闭每个文件更改时的重新加载?我想手动重新加载页面,我也不使用热重新加载,也不想使用它。
对于服务器,我正在使用文件:
对于服务器,我正在使用文件:
/*eslint no-console:0 */
'use strict';
require('core-js/fn/object/assign');
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const config = require('./webpack.config');
const open = require('open');
new WebpackDevServer(webpack(config), config.devServer)
.listen(config.port, 'localhost', (err) => {
if (err) {
console.log(err);
}
console.log('Listening at localhost:' + config.port);
console.log('Opening your system browser...');
open('http://localhost:' + config.port + '/webpack-dev-server/');
});
对于webpack配置,以下是一些部分:
module.exports = {
additionalPaths: additionalPaths,
port: defaultSettings.port,
debug: true,
devtool: 'eval',
output: {
path: path.join(__dirname, '/../dist'),
filename: '[name].js',
publicPath: defaultSettings.publicPath
},
devServer: {
contentBase: './src/',
historyApiFallback: true,
hot: false,
port: defaultSettings.port,
publicPath: defaultSettings.publicPath,
noInfo: false
},
resolve: {
extensions: ['', '.js', '.jsx'],
alias: {
plugins: `${defaultSettings.srcPath}/../plugins`,
core: `${defaultSettings.srcPath}/../core`
}
}
};
以及开发者配置:
let config = Object.assign({}, baseConfig, {
entry: {
start: ['./src/index'],
vendors: [],
core: './plugins/lunchbadger-core/index',
plugins: infoFile.plugins.map((plugin) => { return ('./plugins/lunchbadger-' + plugin); })
},
cache: true,
devtool: 'eval',
plugins: [
new webpack.NoErrorsPlugin()
],
module: defaultSettings.getDefaultModules()
});
angular.json
文件中的architect > serve > options > liveReload
位置找到选项。 - Xriuk