Digital-Assistant / Digital_Assistant_Client

Client for Universal Digital Assistant
GNU Affero General Public License v3.0
4 stars 17 forks source link

Improve webpack config #483

Open kcramakrishna opened 3 months ago

kcramakrishna commented 3 months ago

Need to implement 'best practices' to the current webpack config - separation of dev/prod/common, build speed optimisations etc.

kcramakrishna commented 2 months ago

I used openDevin to run some experiments and got some webpack files which are working but missing some important stuff. I attached the files below:

Please add the following to the below files: (I got them in one experiment but missed in the current experiment)

  1. caching
  2. multi-threading
  3. bundle_analyser
  4. Documentation and inline comments - all 4 files
  5. Optimise Terser options to ignore comments etc?
  6. webpack-dev-server plugin ?
  7. ProgressPlugin

Some help: https://g.co/gemini/share/b893201e733e

I see that 'prod' has terser plugin. I found something interesting from Gemini: https://g.co/gemini/share/66a0104b1068 "Webpack 5: In Webpack 5 and later, the Terser plugin is included by default. You might not need to install it separately unless you require specific configurations."

I am not sure which version of webpack we are using. Please adjust accordingly.

Also please do a final sanity check before merging.

These files will unzip to current directory and not to separate folder. webpack..zip

The above is the output of this experiment: https://github.com/Digital-Assistant/Digital_Assistant_Client/wiki/Webpack-Configuration-Refactoring:-Testing-with-a-simple,-unsophisticated-prompt and will be missing some improvements. You will need to implement, multi-threading, caching, bundle-analyser.

Also attaching the webpack config in ts format. This is only for reference to see that openDevin did a decent job before we decided to leave the config file in js instead of ts. openDevin_Sonnet3.5_webpack.config.zip

kcramakrishna commented 2 months ago

Apparently it is general best practice to have the prod builds in 'dist' folder. Will make these changes and will also add 'dist' in ./gitignore so that it is convenient to developers. For 'prod', we can include 'dist' in commit and then release it.

kcramakrishna commented 2 months ago

Do we want to enable asset compression in webpack or in webserver ?