1

Webpack-dev-server is so slow in rebuilding my simple app, my app is just one component, index.js

This is config.webpack.js file:

const path = require('path');
const HTMLplugin = require('html-webpack-plugin');

const htmlplugin = new HTMLplugin({
    template: './public/index.html'
});

const rules = [
    {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
            loader: 'babel-loader'
        }
    },
    {
        test: /\.css$/,
        exclude: /node_modules/,
        use: ['style-loader', 'css-loader']
    }
];

module.exports = {
    entry: path.join(__dirname, 'src', 'index.js'),
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, './build') 
    },
    module: { rules },
    plugins: [htmlplugin]
}

index.js file:

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App'

const App = () => {
   return (
     <p>Hello World</p>
   )
}

ReactDOM.render(<App />, document.getElementById('root'));

I am new to webpack and i can't really understand why it is that slow although i only have one simple component in my project, i don't know if i should show my package.json file or not as i think it is not related to my problem

What am i doing wrong??

Code Eagle
  • 1,293
  • 1
  • 17
  • 34

0 Answers0