Questions about Webpack-dev-server can't be updated in time

Source: Internet
Author: User

Problem Description:

After configuring the Webpack-dev-server, modify the file and find it can be recompiled, but the browser page is not updated automatically.

For example, I added a new alert (1234) to the script, although the Webpack-dev-server was recompiled, but the browser page did not pop up 1234.

Solve:

You need to configure the Publicpath entry for output in Webpack.config.js. As shown below:

1 output: {2     // address to store after packing 3     // address to use when accessing files 4     FileName: ' js/[name].js '5   }

Explain:

Webpack official website has such a sentence: The Webpack-dev-server also takes a hint from publicPath , using it to determine where to serve the output file S from.

This means that the Webpack-dev-server uses the address provided by the Publicpath configuration item to find the file being serviced.

And we generally think that it will find the file through the address set by path. In fact, the address of path is used to specify where to store the packaged files.

Questions about Webpack-dev-server can't be updated in time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.