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",
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742291550a4416282.html
评论列表(0条)