0

Requirement

  • My requirement is that before publishing the front-end project 'src' to tomcat server, I want to use some tool to md5 it, that is, the file names of all static resources plus the hash values calculated based on their contents, so that when my static resource files are updated, I can solve the problem that the client cache is not updated in time.

Try

  • I tried to bundle my project according to the webpack officer guides and some blog tutorials, but they all need an entry file for index.js, but my project is built in a very simple structure that I don't have an index.js file at all.(the only file which maybe like a 'entry' file is the index.html for the server to identify)
    My project structure here, click me please
  • The index.js is not in my origin project, it is just a temp file after my webpack bundle practice.

So how could I use webpack to bundle my project, or even just don't need webpack at all, as long as I can achieve my requirement?

  • Does this answer your question? [How to load all files in a directory using webpack without require statements](https://stackoverflow.com/questions/29421409/how-to-load-all-files-in-a-directory-using-webpack-without-require-statements) – Andy Ray May 25 '23 at 06:11
  • @AndyRay, If possible, I need a more detailed webpack bundle step for a structured frontend project because i never succeed to do it. :( – diudiudiudiudiu May 25 '23 at 06:23
  • Maybe [gulp](https://gulpjs.com/) is more useful in this case, although I have to say that some plugins are a bit old and I have not tested them, e.g. [gulp-md5-plus](https://www.npmjs.com/package/gulp-md5-plus), [gulp-md5-assets](https://github.com/jirsbek/gulp-md5-assets) – Raxel21 May 25 '23 at 08:34
  • @Raxel21, thanks your advice very much, I have tried the gulp-md5-plus with gulp but failed too, now I am using webpack to bundle my project and get the half done —— the mainpage.html was already loaded after bundle, but the load html Dom function which in the .js of mainpage.html still return 404, I am trying to fix the rest problem. thanks a lot :) – diudiudiudiudiu May 25 '23 at 09:24

0 Answers0