Reputation:
I have a React project that I bundle using Webpack.
The project is small and has only 3 dependencies: react
, react-dom
and react-router-dom
.
I am using the Webpack DevServer for development and it consistently takes about 8 seconds to recompile the project.
My question is, is this how long Webpack normally takes to recompile a small project? Or am I doing something wrong?
My webpack.config.js
file looks like this:
const webpack = require("webpack");
const path = require("path");
const config = {
// ...
devServer: {
contentBase: path.join(__dirname, "dist"),
compress: true,
port: 9000,
hot: true,
},
};
module.exports = config;
Upvotes: 2
Views: 4357
Reputation:
Create react app has a very fast compile time maybe you should consider using it. Otherwise the webpack plugin react hot loader might solve your problem: https://github.com/gaearon/react-hot-loader
Upvotes: 0
Reputation: 323
compress: true,
tells webpack to use gzip compression.
Afaik it's kinda slow, so you probably shouldn't use it for development (apart from testing/debugging).
Try removing that line and check out how much time it takes.
Upvotes: 1