Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
Webpack doesn't reload the page entirely like manual refresh when I make a changes in my js file

I'm building a web app and I have an input element with autofocus Whenever I change something in my app.js webpack automatically refresh the page and apply my changes but that doesn't bring autofocus to my input element

When I reload the page manually I see my input element get into focus like the behavior I expected but when I keep editing and saving my app.js, I see the element lose it's focus

Can I make it work in a way that behave like a manual refresh ?

this is my element in the page which has autofocus

<input class="" type="text" value="" autofocus>

this is my webpack config content

'use strict';

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

module.exports = {
    mode: 'development', // 'production'
    entry: {
        main: path.resolve(__dirname, 'src/app.js')
    },
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: '[name].[contenthash].js',
        // assetModuleFilename: '[name][ext]',
        clean: true
    },
    devtool: 'inline-source-map',
    devServer: {
        static: path.resolve(__dirname, 'src'),
        port: 8080, // default 8080
        open: true,
        hot: true
    },
    // loaders
    module: {
        rules: [
            // css
            {
                test: /\.css$/, use: ['style-loader', 'css-loader']},
            // images
            {
                test: /\.(svg|ico|png|webp|jpg|gif|jpeg)$/, type: 'asset/resource'}
            // js for babel
            // ,{
            //     test: /\.js$/,
            //     exclude: /node_modules/,
            //     use: {
            //         loader: 'babel-loader',
            //         options: {
            //             presets: ['@babel/preset-env']
            //         }
            //     }
            // }
        ]
    },
    // plugins
    plugins: [new HtmlWebpackPlugin({
        title: 'DDS Audit',
        filename: 'index.html',
        template: path.resolve(__dirname, 'src/views/temp.html')
    })]
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda