admin管理员组文章数量:1332389
hers my webpack config which i used for my project.
const HtmlWebPackPlugin = require("html-webpack-plugin");
const LiveReloadPlugin = require("webpack-livereload-plugin");
const DotenvPlugin = require('webpack-dotenv-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const path = require('path');
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: path.resolve(__dirname, 'build'),
filename: 'index.bundle.js',
publicPath: '/'
},
mode: 'development',
devtool: 'source-map',
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true,
port: 8080,
host: '0.0.0.0',
disableHostCheck: true,
},
module: {
rules: [
.........
]
},
plugins: [
new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
}),
new DotenvPlugin({
sample: './.env',
path: './.env'
}),
//new BundleAnalyzerPlugin()
]
};
here is my script from package.json file
"app-start": "webpack-dev-server --config ./webpack.dev.config.js --open",
even after adding this
"app-start": "webpack-dev-server --config ./webpack.dev.config.js --no-inline --no-hot --open",
it doesnt work.
I've also tried putting the hot:false within the webpack config file yet it still reloades the project on save of code.
am i doing something wrong yes please correct.
hers my webpack config which i used for my project.
const HtmlWebPackPlugin = require("html-webpack-plugin");
const LiveReloadPlugin = require("webpack-livereload-plugin");
const DotenvPlugin = require('webpack-dotenv-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const path = require('path');
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: path.resolve(__dirname, 'build'),
filename: 'index.bundle.js',
publicPath: '/'
},
mode: 'development',
devtool: 'source-map',
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true,
port: 8080,
host: '0.0.0.0',
disableHostCheck: true,
},
module: {
rules: [
.........
]
},
plugins: [
new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
}),
new DotenvPlugin({
sample: './.env',
path: './.env'
}),
//new BundleAnalyzerPlugin()
]
};
here is my script from package.json file
"app-start": "webpack-dev-server --config ./webpack.dev.config.js --open",
even after adding this
"app-start": "webpack-dev-server --config ./webpack.dev.config.js --no-inline --no-hot --open",
it doesnt work.
I've also tried putting the hot:false within the webpack config file yet it still reloades the project on save of code.
am i doing something wrong yes please correct.
Share asked May 15, 2019 at 6:13 SnivioSnivio 1,8641 gold badge20 silver badges27 bronze badges 03 Answers
Reset to default 3I understood that you want to avoid the live reload of the application once you do any changes in your code base.
so please try the below config , It might help.
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true,
port: 8080,
host: '0.0.0.0',
disableHostCheck: true,
hot: false,
inline: false
}
make sure you have ejected the webpack using 'npm run eject'.
Running the server with webpack-dev-server --liveReload false
could help I believe.
It worked Now I changed the run script to :
"app-start": "webpack-dev-server --config ./webpack.dev.config.js --no-inline",
本文标签: javascriptCannot disable LiveReloading webapck dev server for my react appStack Overflow
版权声明:本文标题:javascript - Cannot disable LiveReloading webapck dev server for my react app - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742291550a2447889.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论