question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

  • Laravel Mix Version: 6.0.28
  • Node Version: 16.7.0
  • NPM Version: 7.20.3
  • OS: Windows 10

Description:

npm run hot results in the following error:

[webpack-cli] Error: [HPM] Missing "target" option. Example: {target: "http://www.example.org"}

Steps To Reproduce:

I did have this setup working before, but downgrading packages hasn’t worked, not sure what exactly the culprit is:

webpack.mix.js:

let mix = require('laravel-mix');

mix.webpackConfig(require('./webpack.config'));

mix.js('resources/js/app.js', 'js').vue()
    .sass('resources/scss/app.scss', 'css')
    .version();

webpack.config.js:

const path = require('path');

module.exports = {
    output: {chunkFilename: 'js/[name].js?id=[chunkhash]'},
    resolve: {
        alias: {
            '@': path.resolve('resources/js'),
        },
    },
    devServer: {
        proxy: {
            host: '0.0.0.0',
            port: 8080,
            contentBase: path.resolve(__dirname, 'public'),
        }
    }
};

I can get the build to work by providing a target to the proxy, however no live reloading happens despite file changes, e.g.:

devServer: {
    proxy: {
        target: process.env.APP_URL,
        host: '0.0.0.0',
        port: 8080,
        contentBase: path.resolve(__dirname, 'public'),
    }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
jsandfordhughescommented, Aug 27, 2021

Since this morning, #3074 actually fixed it for me, I didnt think it was working at first as the previous console notifications about HMR being active are no longer there however changing a file does indeed update the page.

1reaction
benjivmcommented, Aug 27, 2021

@jsandfordhughes thanks! Updating my config to the following fixed it:

webpack.config.js:

module.exports = {
    output: {chunkFilename: 'js/[name].js?id=[chunkhash]'},
    resolve: {
        alias: {
            '@': path.resolve('resources/js'),
        },
    },
    devServer: {
        allowedHosts: 'all'
    }
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it normal that I can't run in hot weather? - Quora
It all depends on what is considered hot or cold weather. I live near Houston and in August at 7 am the temperature...
Read more >
What to Do When Your Hot Water Isn't Getting Hot Enough
Check and Adjust the Thermostat​​ If you adjust the thermostat and the water temperature remains the same, the problem may be a broken...
Read more >
Hot Water Not Hot Enough: Common Problems and How to ...
What problems should you look for if your water heater is not hot enough and how do you fix them? Here's a guide...
Read more >
5 Common Reasons Why You Run Out of Hot Water
If the dip tube is broken, the cold water will rise to the top of the tank, meaning it cannot be properly heated....
Read more >
No Hot Water? 8 Reasons Why And How To Fix It. - Corro-Protec
No hot water? It's a common problem! Here's a list of the most common causes of hot water problems and why you have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found