Some questions about express and webpack.

Old Ma Nong, jQuery is used to it.
recently learned to use express, in the process of finding data, there are many examples of the combination of express and webpack.

in fact, I can understand the combination of webpack and vue, or self-written pages, because you can package it into a separate file, and then publish or copy it into your own project (whether it"s a java project or a php project).
but since express is already running a web service (which itself is a web project), why package it again with webpack?

even if it is packaged, it should be packaged to the pages or resource files it uses.

for the above doubts, please help me to click.

< hr >

in addition, when packaging with webpack, to prevent the cache that exists during browser access from affecting the test results, you can add the output file name to the hash value ( index.xxxxxxxxxxxxx.js ). I would like to ask how to easily apply this kind of file to the project (such as the java project).

according to my current understanding, the whole process should be, after the front-end development, use webpack to package the js file, and output the packaged file to the corresponding resource file directory of the java project, while the html file of the java project already exists in the project view directory, and only needs to reference a js file in it. But what about the hash value added to this file name? Do you also have to manually write the file name with the hash value every time?

Mar.16,2021

personal humble opinion, webpack is modularization, and I feel that babel is also used in your project. These two often appear together, with them there will be a lot of benefits, such as the use of stage-0 proposal-level syntax to make the code easier to write and more modular development.


first of all, express is a node-based Web application development framework. Most of the time, all express does is send files to browsers according to specific routing rules.

the files here include html, as well as js and css.

if you use vue, chances are you will also use the vue single file component (xx.vue), as well as the es6 syntax.

xxx.vue browsers are not recognized, and there is a certain probability that es6 is not recognized. Therefore, you need to compile xx.vue, es6, and so on into something the browser knows.

for example, xx.vue is split into xx.js and xx.css;es6 is converted into es5;

this conversion process is what webpack + various loader does: transcoding + packaging.

After

conversion, you will get ordinary html, js and css files that the browser can recognize. Throw it into the express and everything will be fine.

as for what the landlord said to package it with webpack express, this is rare. If the code under the express project needs to be converted for special reasons, it is understandable with webpack, but it is usually not a good choice.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34068-4046a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34068-4046a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?